Getting the underlying web error when querying a feature layer?

709
2
10-29-2020 09:14 AM
Jan-Tschada
Esri Contributor

We just ran into a situation where the Qt app is constructing an invalid "where clause" and the underlying web error need to be handled. For instance, when querying a "date field" we have to use the "event_date = DATE '2020-02-29' " or "event_date = TIMESTAMP '2020-02-29 00:00:00' " SQL expressions. So when we were using the UNIX timestamp directly like "event_date=1582934400" the REST endpoint returned:

{   "error" :    {     "code" : 400,      "message" : "Cannot perform query. Invalid query parameters.",      "details" : [       "Unable to perform query. Please check your parameters."     ]   } }

The FeatureTable::queryFeaturesCompleted slot is called and gets an uninitialized FeatureQueryResult instance.

We took a look at the current ArcGIS Runtime .NET implementation and the runtime is throwing a web exception wrapping the returned details.

Is it possible to get the underlying web error by using the current Qt implementation?

Product Manager
Developers and Location Services
Germany and Switzerland
Tags (2)
0 Kudos
2 Replies
JamesBallard1
Esri Regular Contributor

Hi Jan Tschada‌,

   No, unfortunately there is no guaranteed way to get the http service error from the Qt API. In some cases, this information will be part of the error object, and you can connect to that like follows:

connect(featureTable, &FeatureTable::errorOccurred, this, [](const Error& error)
{
  qDebug() << "FeatureTable error:" << error.message() << error.additionalMessage();
});

But however, it is not a guarantee that this information will be included with the error object.

Let me know if this helps.

Jan-Tschada
Esri Contributor

Works like a charm thank you.

Product Manager
Developers and Location Services
Germany and Switzerland
0 Kudos