heat API : Return correct AWS error response for invalid parameter
Passing template parameter values which are not in AllowedValues makes the engine throw a ValueError exception, which should be mapped back to HeatInvalidParameterValueError so that the API error response is correctly formatted. Fixes #180 Change-Id: I8615cb7fbbbfd21a403a4973fe0a63300c6cf852 Signed-off-by: Steven Hardy <shardy@redhat.com>
This commit is contained in:
parent
e3e011b9cb
commit
c69f3892c2
@ -72,8 +72,8 @@ class StackController(object):
|
|||||||
to HeatAPIException subclasses which can be used to return
|
to HeatAPIException subclasses which can be used to return
|
||||||
properly formatted AWS error responses
|
properly formatted AWS error responses
|
||||||
"""
|
"""
|
||||||
if ex.exc_type == 'AttributeError':
|
if ex.exc_type in ('AttributeError', 'ValueError'):
|
||||||
# Attribute error, bad user data, ex.value should tell us why
|
# Attribute/Value error, bad user data, ex.value should tell us why
|
||||||
return exception.HeatInvalidParameterValueError(detail=ex.value)
|
return exception.HeatInvalidParameterValueError(detail=ex.value)
|
||||||
else:
|
else:
|
||||||
# Map everything else to internal server error for now
|
# Map everything else to internal server error for now
|
||||||
|
Loading…
Reference in New Issue
Block a user