Skip to content

Commit

Permalink
Add error item in browser when MapServer connections fail
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed May 30, 2019
1 parent 8b9fbed commit 9fd2866
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/providers/arcgisrest/qgsamsdataitems.cpp
Expand Up @@ -18,6 +18,7 @@
#include "qgsarcgisrestutils.h"
#include "qgsowsconnection.h"
#include "qgsproviderregistry.h"
#include "qgslogger.h"

#ifdef HAVE_GUI
#include "qgsamssourceselect.h"
Expand Down Expand Up @@ -104,6 +105,13 @@ QVector<QgsDataItem *> QgsAmsConnectionItem::createChildren()
QVariantMap serviceData = QgsArcGisRestUtils::getServiceInfo( url, authcfg, errorTitle, errorMessage );
if ( serviceData.isEmpty() )
{
if ( !errorMessage.isEmpty() )
{
std::unique_ptr< QgsErrorItem > error = qgis::make_unique< QgsErrorItem >( this, tr( "Connection failed: %1" ).arg( errorTitle ), mPath + "/error" );
error->setToolTip( errorMessage );
layers.append( error.release() );
QgsDebugMsg( "Connection failed - " + errorMessage );
}
return layers;
}

Expand Down

0 comments on commit 9fd2866

Please sign in to comment.