From c3b50e406b8f817dc712f89daf2f7709bf05b212 Mon Sep 17 00:00:00 2001 From: Tor-Einar Skog <tor-einar.skog@nibio.no> Date: Tue, 31 May 2022 11:59:48 +0200 Subject: [PATCH] Improving error messages from endpoint --- .../java/no/nibio/vips/core/service/ModelResourceImpl.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/no/nibio/vips/core/service/ModelResourceImpl.java b/src/main/java/no/nibio/vips/core/service/ModelResourceImpl.java index 2741592..a1fc112 100755 --- a/src/main/java/no/nibio/vips/core/service/ModelResourceImpl.java +++ b/src/main/java/no/nibio/vips/core/service/ModelResourceImpl.java @@ -295,7 +295,11 @@ public class ModelResourceImpl implements ModelResource{ Logger.getLogger(ModelResourceImpl.class.getName()).log(Level.SEVERE, null, ex); if(ex instanceof ConfigValidationException){ - throw new WebApplicationException(Response.status(Response.Status.BAD_REQUEST).entity(ex).build()); + throw new WebApplicationException(Response.status(Response.Status.BAD_REQUEST).entity(ex.getMessage()).build()); + } + else if(ex instanceof NoSuchModelException) + { + throw new WebApplicationException(Response.status(Response.Status.BAD_REQUEST).entity(ex.getMessage()).build()); } else { -- GitLab