From c69f3892c2563cefdc26e6bdb54bc2c2e7c7cae5 Mon Sep 17 00:00:00 2001 From: Steven Hardy Date: Fri, 27 Jul 2012 14:43:37 +0100 Subject: [PATCH] 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 --- heat/api/v1/stacks.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/heat/api/v1/stacks.py b/heat/api/v1/stacks.py index 41b8dbcd..73ba343e 100644 --- a/heat/api/v1/stacks.py +++ b/heat/api/v1/stacks.py @@ -72,8 +72,8 @@ class StackController(object): to HeatAPIException subclasses which can be used to return properly formatted AWS error responses """ - if ex.exc_type == 'AttributeError': - # Attribute error, bad user data, ex.value should tell us why + if ex.exc_type in ('AttributeError', 'ValueError'): + # Attribute/Value error, bad user data, ex.value should tell us why return exception.HeatInvalidParameterValueError(detail=ex.value) else: # Map everything else to internal server error for now -- 2.45.2