Skip to content

Commit 774dda3

Browse files
author
mhugent
committed
Apply patch #2891, WFS exception. Thanks to strk
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13956 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 370ad5a commit 774dda3

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/plugins/wfs/qgswfssourceselect.cpp

+11-8
Original file line numberDiff line numberDiff line change
@@ -150,28 +150,31 @@ int QgsWFSSourceSelect::getCapabilitiesGET( QString uri, std::list<QString>& typ
150150
QgsHttpTransaction http( request );
151151
if ( !http.getSynchronously( result ) )
152152
{
153-
QMessageBox::critical( 0, tr( "Could not download capabilities document" ), http.errorString() );
153+
QMessageBox::critical( 0, tr( "Error" ),
154+
tr( "Could not download capabilities document: " ) + http.errorString() );
154155
return 1;
155156
}
156157

157158
QDomDocument capabilitiesDocument;
158159
QString capabilitiesDocError;
159160
if ( !capabilitiesDocument.setContent( result, true, &capabilitiesDocError ) )
160161
{
161-
QMessageBox::critical( 0, tr( "Capabilities document is not valid" ), capabilitiesDocError );
162+
QMessageBox::critical( 0, tr( "Error" ),
163+
tr( "Capabilities document is not valid: " ) + capabilitiesDocError );
162164
return 1;
163165
}
164166

165-
QDomNodeList exlist = capabilitiesDocument.elementsByTagName( "ExceptionText" );
166-
if ( exlist.length() )
167+
QDomElement doc = capabilitiesDocument.documentElement();
168+
if ( doc.tagName() == "ExceptionReport" )
167169
{
168-
QDomElement ex = exlist.at( 0 ).toElement();
169-
QMessageBox::critical( 0, tr( "Error" ), ex.firstChild().nodeValue() );
170+
QDomNode ex = doc.firstChild();
171+
QString exc = ex.toElement().attribute("exceptionCode", "Exception");
172+
QDomElement ext = ex.firstChild().toElement();
173+
QMessageBox::critical( 0, tr( "Error" ),
174+
exc + ": " + ext.firstChild().nodeValue() );
170175
return 1;
171176
}
172177

173-
174-
175178
//get the <FeatureType> elements
176179
QDomNodeList featureTypeList = capabilitiesDocument.elementsByTagNameNS( WFS_NAMESPACE, "FeatureType" );
177180
for ( unsigned int i = 0; i < featureTypeList.length(); ++i )

0 commit comments

Comments
 (0)