Skip to content

Commit

Permalink
Update exceptions for StyleNotDefined and LayerNotQueryable
Browse files Browse the repository at this point in the history
  • Loading branch information
pblottiere committed Mar 28, 2019
1 parent 2fc3da3 commit 4c09957
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
11 changes: 6 additions & 5 deletions src/server/services/wms/qgswmsrenderer.cpp
Expand Up @@ -1313,12 +1313,13 @@ namespace QgsWms
param.mValue = queryLayer;
throw QgsBadRequestException( QgsServiceException::OGC_LAYER_NOT_DEFINED,
param );

}
else if ( ( validLayer && !queryableLayer ) || ( !validLayer && mContext.isValidGroup( queryLayer ) ) )
{
QString msg = QObject::tr( "Layer '%1' is not queryable" ).arg( queryLayer );
throw QgsBadRequestException( QStringLiteral( "LayerNotQueryable" ), msg );
QgsWmsParameter param( QgsWmsParameter::LAYER );
param.mValue = queryLayer;
throw QgsBadRequestException( QgsServiceException::OGC_LAYER_NOT_QUERYABLE,
param );
}
}

Expand Down Expand Up @@ -3050,8 +3051,8 @@ namespace QgsWms
bool rc = layer->styleManager()->setCurrentStyle( style );
if ( ! rc )
{
throw QgsMapServiceException( QStringLiteral( "StyleNotDefined" ),
QStringLiteral( "Style \"%1\" does not exist for layer \"%2\"" ).arg( style, layer->name() ) );
throw QgsBadRequestException( QgsServiceException::OGC_STYLE_NOT_DEFINED,
QStringLiteral( "Style '%1' does not exist for layer '%2'" ).arg( style, layer->name() ) );
}
}

Expand Down
8 changes: 6 additions & 2 deletions src/server/services/wms/qgswmsserviceexception.h
Expand Up @@ -114,7 +114,7 @@ namespace QgsWms
}
case OGC_INVALID_FORMAT:
{
message = QStringLiteral( "The format %1 from %2 is not supported." ).arg( parameter.toString(), name );
message = QStringLiteral( "The format '%1' from %2 is not supported." ).arg( parameter.toString(), name );
break;
}
case OGC_INVALID_SRS:
Expand All @@ -132,8 +132,12 @@ namespace QgsWms
message = QStringLiteral( "The layer '%1' does not exist." ).arg( parameter.toString() );
break;
}
case OGC_STYLE_NOT_DEFINED:
case OGC_LAYER_NOT_QUERYABLE:
{
message = QStringLiteral( "The layer '%1' is not queryable." ).arg( parameter.toString() );
break;
}
case OGC_STYLE_NOT_DEFINED:
case OGC_CURRENT_UPDATE_SEQUENCE:
case OGC_INVALID_UPDATE_SEQUENCE:
case OGC_MISSING_DIMENSION_VALUE:
Expand Down

0 comments on commit 4c09957

Please sign in to comment.