Skip to content

Commit

Permalink
Add more exception in getPrint
Browse files Browse the repository at this point in the history
  • Loading branch information
pblottiere committed Mar 28, 2019
1 parent 0f0438f commit 95f4d37
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/server/services/wms/qgswmsrenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ namespace QgsWms
if ( sourceLayout->pageCollection()->pageCount() < 1 )
{
throw QgsBadRequestException( QgsServiceException::QGIS_INVALID_PARAMETER_VALUE,
QStringLiteral( "Template '%1' has no pages" ).arg( templateName ) );
QStringLiteral( "The template has no pages" ) );
}

std::unique_ptr<QgsPrintLayout> layout( sourceLayout->clone() );
Expand All @@ -300,14 +300,14 @@ namespace QgsWms
if ( !atlas || !atlas->enabled() )
{
//error
throw QgsBadRequestException( QStringLiteral( "NoAtlas" ),
throw QgsBadRequestException( QgsServiceException::QGIS_INVALID_PARAMETER_VALUE,
QStringLiteral( "The template has no atlas enabled" ) );
}

QgsVectorLayer *cLayer = atlas->coverageLayer();
if ( !cLayer )
{
throw QgsBadRequestException( QStringLiteral( "AtlasPrintError" ),
throw QgsBadRequestException( QgsServiceException::QGIS_INVALID_PARAMETER_VALUE,
QStringLiteral( "The atlas has no coverage layer" ) );
}

Expand All @@ -318,7 +318,7 @@ namespace QgsWms
atlas->updateFeatures();
if ( atlas->count() > maxAtlasFeatures )
{
throw QgsBadRequestException( QStringLiteral( "AtlasPrintError" ),
throw QgsBadRequestException( QgsServiceException::QGIS_INVALID_PARAMETER_VALUE,
QString( "The project configuration allows printing maximum %1 atlas features at a time" ).arg( maxAtlasFeatures ) );
}
}
Expand All @@ -339,14 +339,14 @@ namespace QgsWms
int nAtlasFeatures = atlasPk.size() / pkIndexes.size();
if ( nAtlasFeatures * pkIndexes.size() != atlasPk.size() ) //Test is atlasPk.size() is a multiple of pkIndexes.size(). Bail out if not
{
throw QgsBadRequestException( QStringLiteral( "AtlasPrintError" ),
throw QgsBadRequestException( QgsServiceException::QGIS_INVALID_PARAMETER_VALUE,
QStringLiteral( "Wrong number of ATLAS_PK parameters" ) );
}

//number of atlas features might be restricted
if ( nAtlasFeatures > maxAtlasFeatures )
{
throw QgsBadRequestException( QStringLiteral( "AtlasPrintError" ),
throw QgsBadRequestException( QgsServiceException::QGIS_INVALID_PARAMETER_VALUE,
QString( "%1 atlas features have been requestet, but the project configuration only allows printing %2 atlas features at a time" )
.arg( nAtlasFeatures ).arg( maxAtlasFeatures ) );
}
Expand Down

0 comments on commit 95f4d37

Please sign in to comment.