summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorabcd <amos.choy@nokia.com>2012-07-30 13:54:48 +1000
committerQt by Nokia <qt-info@nokia.com>2012-08-02 07:16:28 +0200
commit29760b127b4f4a6de8d178f6049b05f1c338ffb0 (patch)
treea97abb21ddea3d3a3ea3be85867cff3164092de0
parentf5c58c6a3d77aeee1f8d3bc152aa3731efefac0e (diff)
Fix incorrect error code during recommendation search
Previously a CommunicationError was returned if the id did not exist, this was because an incorrect id would result in a non-esistent URL being used. Now we make the assumption that if the URL content is not found, then it must be because the id did not exist. In such a case we can return a PlaceDoesNotExistError. Change-Id: I50ddacb2341639dd6e227e795cefc5e92eea3d6e Reviewed-by: Alex <alex.blasche@nokia.com>
-rw-r--r--src/plugins/geoservices/nokia/placesv2/qplacesearchreplyimpl.cpp5
-rw-r--r--tests/auto/nokia_services/places_semiauto/tst_places.cpp2
2 files changed, 6 insertions, 1 deletions
diff --git a/src/plugins/geoservices/nokia/placesv2/qplacesearchreplyimpl.cpp b/src/plugins/geoservices/nokia/placesv2/qplacesearchreplyimpl.cpp
index 8bcfd6a2..b82e3b20 100644
--- a/src/plugins/geoservices/nokia/placesv2/qplacesearchreplyimpl.cpp
+++ b/src/plugins/geoservices/nokia/placesv2/qplacesearchreplyimpl.cpp
@@ -103,6 +103,11 @@ void QPlaceSearchReplyImpl::replyFinished()
case QNetworkReply::OperationCanceledError:
setError(CancelError, QCoreApplication::translate(NOKIA_PLUGIN_CONTEXT_NAME, CANCEL_ERROR));
break;
+ case QNetworkReply::ContentNotFoundError:
+ setError(PlaceDoesNotExistError,
+ QString::fromLatin1("The id, %1, does not reference an existing place")
+ .arg(request().recommendationId()));
+ break;
default:
setError(CommunicationError, QCoreApplication::translate(NOKIA_PLUGIN_CONTEXT_NAME, NETWORK_ERROR));
}
diff --git a/tests/auto/nokia_services/places_semiauto/tst_places.cpp b/tests/auto/nokia_services/places_semiauto/tst_places.cpp
index 6d2e223a..f0f9cf1b 100644
--- a/tests/auto/nokia_services/places_semiauto/tst_places.cpp
+++ b/tests/auto/nokia_services/places_semiauto/tst_places.cpp
@@ -346,7 +346,7 @@ void tst_QPlaceManagerNokia::recommendations_data()
<< QString()
<< QGeoShape()
<< QList<QPlaceCategory>()
- << QPlaceReply::CommunicationError;
+ << QPlaceReply::PlaceDoesNotExistError;
QTest::newRow("search for recommendations with id and search term")
<< QString(AuvergneEmbassyId)