Skip to content

Commit

Permalink
More descriptive error messages when arcgis rest calls fail
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Oct 17, 2018
1 parent 100a14e commit 7241025
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/providers/arcgisrest/qgsarcgisrestutils.cpp
Expand Up @@ -521,7 +521,15 @@ QVariantMap QgsArcGisRestUtils::queryServiceJSON( const QUrl &url, QString &erro
QgsDebugMsg( QStringLiteral( "Parsing error: %1" ).arg( err.errorString() ) );
return QVariantMap();
}
return doc.object().toVariantMap();
const QVariantMap res = doc.object().toVariantMap();
if ( res.contains( QStringLiteral( "error" ) ) )
{
const QVariantMap error = res.value( QStringLiteral( "error" ) ).toMap();
errorText = error.value( QStringLiteral( "message" ) ).toString();
errorTitle = QObject::tr( "Error %1" ).arg( error.value( QStringLiteral( "code" ) ).toString() );
return QVariantMap();
}
return res;
}

std::unique_ptr<QgsSymbol> QgsArcGisRestUtils::parseEsriSymbolJson( const QVariantMap &symbolData )
Expand Down

0 comments on commit 7241025

Please sign in to comment.