Skip to content

Commit

Permalink
Update InvalidCRS / InvalidSRS exception according to the version
Browse files Browse the repository at this point in the history
  • Loading branch information
pblottiere committed Mar 28, 2019
1 parent 2430d9c commit 5eca1f1
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
16 changes: 15 additions & 1 deletion src/server/services/wms/qgswmsrenderer.cpp
Expand Up @@ -1064,7 +1064,21 @@ namespace QgsWms
outputCRS = QgsCoordinateReferenceSystem::fromOgcWmsCrs( crs );
if ( !outputCRS.isValid() )
{
throw QgsBadRequestException( QStringLiteral( "InvalidCRS" ), QStringLiteral( "Could not create output CRS" ) );
QgsServiceException::ExceptionCode code;
QgsWmsParameter parameter;

if ( mWmsParameters.versionAsNumber() >= QgsProjectVersion( 1, 3, 0 ) )
{
code = QgsServiceException::OGC_INVALID_CRS;
parameter = mWmsParameters[ QgsWmsParameter::CRS ];
}
else
{
code = QgsServiceException::OGC_INVALID_SRS;
parameter = mWmsParameters[ QgsWmsParameter::SRS ];
}

throw QgsBadRequestException( code, parameter );
}

//then set destinationCrs
Expand Down
10 changes: 9 additions & 1 deletion src/server/services/wms/qgswmsserviceexception.h
Expand Up @@ -118,14 +118,22 @@ namespace QgsWms
break;
}
case OGC_INVALID_SRS:
{
message = QStringLiteral( "The SRS is not valid." );
break;
}
case OGC_INVALID_CRS:
{
message = QStringLiteral( "The CRS is not valid." );
break;
}
case OGC_LAYER_NOT_DEFINED:
case OGC_STYLE_NOT_DEFINED:
case OGC_LAYER_NOT_QUERYABLE:
case OGC_CURRENT_UPDATE_SEQUENCE:
case OGC_INVALID_UPDATE_SEQUENCE:
case OGC_MISSING_DIMENSION_VALUE:
case OGC_INVALID_DIMENSION_VALUE:
case OGC_INVALID_CRS:
case OGC_OPERATION_NOT_SUPPORTED:
case QGIS_ERROR:
{
Expand Down

0 comments on commit 5eca1f1

Please sign in to comment.