Skip to content
Permalink
Browse files
Apply patch #2891, WFS exception. Thanks to strk
git-svn-id: http://svn.osgeo.org/qgis/trunk@13956 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Jul 24, 2010
1 parent 2695fcd commit e357842e62a6e30c329e13d32f473a00198317cb
Showing with 11 additions and 8 deletions.
  1. +11 −8 src/plugins/wfs/qgswfssourceselect.cpp
@@ -150,28 +150,31 @@ int QgsWFSSourceSelect::getCapabilitiesGET( QString uri, std::list<QString>& typ
QgsHttpTransaction http( request );
if ( !http.getSynchronously( result ) )
{
QMessageBox::critical( 0, tr( "Could not download capabilities document" ), http.errorString() );
QMessageBox::critical( 0, tr( "Error" ),
tr( "Could not download capabilities document: " ) + http.errorString() );
return 1;
}

QDomDocument capabilitiesDocument;
QString capabilitiesDocError;
if ( !capabilitiesDocument.setContent( result, true, &capabilitiesDocError ) )
{
QMessageBox::critical( 0, tr( "Capabilities document is not valid" ), capabilitiesDocError );
QMessageBox::critical( 0, tr( "Error" ),
tr( "Capabilities document is not valid: " ) + capabilitiesDocError );
return 1;
}

QDomNodeList exlist = capabilitiesDocument.elementsByTagName( "ExceptionText" );
if ( exlist.length() )
QDomElement doc = capabilitiesDocument.documentElement();
if ( doc.tagName() == "ExceptionReport" )
{
QDomElement ex = exlist.at( 0 ).toElement();
QMessageBox::critical( 0, tr( "Error" ), ex.firstChild().nodeValue() );
QDomNode ex = doc.firstChild();
QString exc = ex.toElement().attribute("exceptionCode", "Exception");
QDomElement ext = ex.firstChild().toElement();
QMessageBox::critical( 0, tr( "Error" ),
exc + ": " + ext.firstChild().nodeValue() );
return 1;
}



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

0 comments on commit e357842

Please sign in to comment.