Skip to content
Permalink
Browse files

Write entry to server log if a datasource/map/print composition is no…

…t valid
  • Loading branch information
mhugent committed Jan 19, 2019
1 parent 575d385 commit abd6297da61118f609e16914fe94cdd3855bf0da
@@ -48,6 +48,8 @@ const QgsProject *QgsConfigCache::project( const QString &path )
{
if ( badLayerHandler->badLayers().size() > 0 )
{
QString errorMsg = QString( "Layer(s) %1 not valid" ).arg( badLayerHandler->badLayers().join( ',' ) );
QgsMessageLog::logMessage( errorMsg, QStringLiteral( "Server" ), Qgis::Critical );
throw QgsServerException( QStringLiteral( "Layer(s) not valid" ) );
}
mProjectCache.insert( path, prj.release() );
@@ -68,7 +68,7 @@ QgsFcgiServerRequest::QgsFcgiServerRequest()
}

// Store the URL before the server rewrite that could have been set in QUERY_STRING
//mOriginalUrl = url;
mOriginalUrl = url;

// OGC parameters are passed with the query string, which is normally part of
// the REQUEST_URI, we override the query string url in case it is defined
@@ -2930,11 +2930,16 @@ namespace QgsWms
if ( !renderJob.errors().isEmpty() )
{
QString layerWMSName;
QgsMapLayer *errorLayer = mProject->mapLayer( renderJob.errors().at( 0 ).layerID );
QString firstErrorLayerId = renderJob.errors().at( 0 ).layerID;
QgsMapLayer *errorLayer = mProject->mapLayer( firstErrorLayerId );
if ( errorLayer )
{
layerWMSName = layerNickname( *errorLayer );
}

//Log first error
QString errorMsg = QString( "Map rendering error in layer '%1'" ).arg( firstErrorLayerId );
QgsMessageLog::logMessage( errorMsg, "Server", Qgis::Critical );
throw QgsServerException( QString( "Map rendering error in layer '%1'" ).arg( layerWMSName ) );
}
}
@@ -3274,6 +3279,11 @@ namespace QgsWms
{
if ( !( *mapIt )->renderingErrors().isEmpty() )
{
//Log first error
QgsMapRendererJob::Error e = ( *mapIt )->renderingErrors().at( 0 );
QString errorMsg = QString( "Rendering error : '%1' in layer %2" ).arg( e.message ).arg( e.layerID );
QgsMessageLog::logMessage( errorMsg, "Server", Qgis::Critical );

throw QgsServerException( QStringLiteral( "Print error" ) );
}
}

0 comments on commit abd6297

Please sign in to comment.
You can’t perform that action at this time.