Use QSystemError for QDnsLookup windows backend

The OS provides the error string in this case.
This gives more information to the developer seeing a generic
error.

Change-Id: Ia03642982f3513ee5a8a9fa98d918e948f8d97a5
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Richard J. Moore <rich@kde.org>
This commit is contained in:
Shane Kearns 2012-02-24 13:07:24 +00:00 committed by Qt by Nokia
parent 762a721f7f
commit d19d25a68b
2 changed files with 3 additions and 2 deletions

View File

@ -44,6 +44,7 @@
#include <qurl.h>
#include <private/qmutexpool_p.h>
#include <private/qsystemerror_p.h>
#include <qt_windows.h>
#include <windns.h>
@ -76,7 +77,7 @@ void QDnsLookupRunnable::query(const int requestType, const QByteArray &requestN
return;
default:
reply->error = QDnsLookup::InvalidReplyError;
reply->errorString = tr("Invalid reply received");
reply->errorString = QSystemError(status, QSystemError::NativeError).toString();
return;
}

View File

@ -139,7 +139,7 @@ void tst_QDnsLookup::lookup()
lookup.lookup();
QVERIFY(waitForDone(&lookup));
QVERIFY(lookup.isFinished());
QCOMPARE(int(lookup.error()), error);
QVERIFY2(int(lookup.error()) == error, qPrintable(lookup.errorString()));
if (error == QDnsLookup::NoError)
QVERIFY(lookup.errorString().isEmpty());
QCOMPARE(int(lookup.type()), type);