Skip to content

Commit bdda371

Browse files
committed
Add more auto formatted message for missing parameter
1 parent cac591c commit bdda371

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/server/services/wms/qgswmsgetstyles.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@ namespace QgsWms
5959

6060
if ( layersName.isEmpty() )
6161
{
62-
throw QgsBadRequestException( QStringLiteral( "LayerNotSpecified" ),
63-
QStringLiteral( "Layers is mandatory for GetStyles operation" ) );
62+
throw QgsBadRequestException( QgsServiceException::QGIS_MISSING_PARAMETER_VALUE,
63+
QgsWmsParameter::LAYERS );
6464
}
6565

6666
QStringList layerList = layersName.split( ',', QString::SkipEmptyParts );
6767
if ( layerList.isEmpty() )
6868
{
69-
throw QgsBadRequestException( QStringLiteral( "LayerNotSpecified" ),
70-
QStringLiteral( "Layers is mandatory for GetStyles operation" ) );
69+
throw QgsBadRequestException( QgsServiceException::QGIS_MISSING_PARAMETER_VALUE,
70+
QgsWmsParameter::LAYERS );
7171
}
7272

7373
return getStyledLayerDescriptorDocument( serverIface, project, layerList );
@@ -96,14 +96,14 @@ namespace QgsWms
9696

9797
if ( styleName.isEmpty() )
9898
{
99-
throw QgsServiceException( QStringLiteral( "StyleNotSpecified" ),
100-
QStringLiteral( "Style is mandatory for GetStyle operation" ), 400 );
99+
throw QgsBadRequestException( QgsServiceException::QGIS_MISSING_PARAMETER_VALUE,
100+
QgsWmsParameter::STYLE );
101101
}
102102

103103
if ( layerName.isEmpty() )
104104
{
105-
throw QgsServiceException( QStringLiteral( "LayerNotSpecified" ),
106-
QStringLiteral( "Layer is mandatory for GetStyle operation" ), 400 );
105+
throw QgsBadRequestException( QgsServiceException::QGIS_MISSING_PARAMETER_VALUE,
106+
QgsWmsParameter::LAYERS );
107107
}
108108

109109
QStringList layerList;

src/server/services/wms/qgswmsrenderer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ namespace QgsWms
132132
// check parameters
133133
if ( mWmsParameters.allLayersNickname().isEmpty() )
134134
throw QgsBadRequestException( QgsServiceException::QGIS_MISSING_PARAMETER_VALUE,
135-
QgsWmsParameter::LAYER );
135+
QgsWmsParameter::LAYERS );
136136

137137
if ( mWmsParameters.format() == QgsWmsParameters::Format::NONE )
138138
throw QgsBadRequestException( QgsServiceException::QGIS_MISSING_PARAMETER_VALUE,

0 commit comments

Comments
 (0)