Fixing error messages when updating deployment policy
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/92c77ab5 Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/92c77ab5 Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/92c77ab5 Branch: refs/heads/master Commit: 92c77ab5a0ef9c79fe6bbbcf012c2e67c6dfbaea Parents: b421b81 Author: anuruddhal <[email protected]> Authored: Tue May 19 18:29:08 2015 +0530 Committer: Imesh Gunaratne <[email protected]> Committed: Tue May 19 18:36:21 2015 +0530 ---------------------------------------------------------------------- .../org/apache/stratos/rest/endpoint/api/StratosApiV41.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/stratos/blob/92c77ab5/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41.java index 5cbf30a..095fdf0 100644 --- a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41.java +++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41.java @@ -242,11 +242,13 @@ public class StratosApiV41 extends AbstractApi { StratosApiV41Utils.updateDeploymentPolicy(deploymentPolicyDefinitionBean); } catch (AutoscalerServiceInvalidPolicyExceptionException e) { + String backendErrorMessage = e.getFaultMessage().getInvalidPolicyException().getMessage(); return Response.status(Response.Status.BAD_REQUEST).entity(new ResponseMessageBean( - ResponseMessageBean.ERROR, "Deployment policy is invalid")).build(); + ResponseMessageBean.ERROR, backendErrorMessage)).build(); } catch (AutoscalerServiceInvalidDeploymentPolicyExceptionException e) { + String backendErrorMessage = e.getFaultMessage().getInvalidDeploymentPolicyException().getMessage(); return Response.status(Response.Status.BAD_REQUEST).entity(new ResponseMessageBean( - ResponseMessageBean.ERROR, "Deployment policy is invalid")).build(); + ResponseMessageBean.ERROR, backendErrorMessage)).build(); } catch (AutoscalerServiceDeploymentPolicyNotExistsExceptionException e) { return Response.status(Response.Status.NOT_FOUND).entity(new ResponseMessageBean( ResponseMessageBean.ERROR, "Deployment policy not found")).build();
