Skip to content

Commit

Permalink
[WFS provider] Use ows:ExceptionReport for error message (fixes #42985)
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault authored and nyalldawson committed May 21, 2021
1 parent d3dfc64 commit b5c5cc7
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/providers/wfs/qgsbasenetworkrequest.cpp
Expand Up @@ -448,6 +448,20 @@ void QgsBaseNetworkRequest::replyFinished()
else
{
mErrorMessage = errorMessageWithReason( mReply->errorString() );
QString replyContent = mReply->readAll();
QDomDocument exceptionDoc;
QString errorMsg;
if ( exceptionDoc.setContent( replyContent, true, &errorMsg ) )
{
QDomElement exceptionElem = exceptionDoc.documentElement();
if ( !exceptionElem.isNull() && exceptionElem.tagName() == QLatin1String( "ExceptionReport" ) )
{
QDomElement exception = exceptionElem.firstChildElement( QStringLiteral( "Exception" ) );
mErrorMessage = tr( "WFS exception report (code=%1 text=%2)" )
.arg( exception.attribute( QStringLiteral( "exceptionCode" ), tr( "missing" ) ),
exception.firstChildElement( QStringLiteral( "ExceptionText" ) ).text() );
}
}
mErrorCode = QgsBaseNetworkRequest::ServerExceptionError;
logMessageIfEnabled();
mResponse.clear();
Expand Down

0 comments on commit b5c5cc7

Please sign in to comment.