Skip to content

Commit 5eca1f1

Browse files
committedMar 28, 2019
Update InvalidCRS / InvalidSRS exception according to the version
1 parent 2430d9c commit 5eca1f1

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed
 

‎src/server/services/wms/qgswmsrenderer.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1064,7 +1064,21 @@ namespace QgsWms
10641064
outputCRS = QgsCoordinateReferenceSystem::fromOgcWmsCrs( crs );
10651065
if ( !outputCRS.isValid() )
10661066
{
1067-
throw QgsBadRequestException( QStringLiteral( "InvalidCRS" ), QStringLiteral( "Could not create output CRS" ) );
1067+
QgsServiceException::ExceptionCode code;
1068+
QgsWmsParameter parameter;
1069+
1070+
if ( mWmsParameters.versionAsNumber() >= QgsProjectVersion( 1, 3, 0 ) )
1071+
{
1072+
code = QgsServiceException::OGC_INVALID_CRS;
1073+
parameter = mWmsParameters[ QgsWmsParameter::CRS ];
1074+
}
1075+
else
1076+
{
1077+
code = QgsServiceException::OGC_INVALID_SRS;
1078+
parameter = mWmsParameters[ QgsWmsParameter::SRS ];
1079+
}
1080+
1081+
throw QgsBadRequestException( code, parameter );
10681082
}
10691083

10701084
//then set destinationCrs

‎src/server/services/wms/qgswmsserviceexception.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,22 @@ namespace QgsWms
118118
break;
119119
}
120120
case OGC_INVALID_SRS:
121+
{
122+
message = QStringLiteral( "The SRS is not valid." );
123+
break;
124+
}
125+
case OGC_INVALID_CRS:
126+
{
127+
message = QStringLiteral( "The CRS is not valid." );
128+
break;
129+
}
121130
case OGC_LAYER_NOT_DEFINED:
122131
case OGC_STYLE_NOT_DEFINED:
123132
case OGC_LAYER_NOT_QUERYABLE:
124133
case OGC_CURRENT_UPDATE_SEQUENCE:
125134
case OGC_INVALID_UPDATE_SEQUENCE:
126135
case OGC_MISSING_DIMENSION_VALUE:
127136
case OGC_INVALID_DIMENSION_VALUE:
128-
case OGC_INVALID_CRS:
129137
case OGC_OPERATION_NOT_SUPPORTED:
130138
case QGIS_ERROR:
131139
{

0 commit comments

Comments
 (0)
Please sign in to comment.