Catch IllegalArgumentException for error message
[aai/champ.git] / champ-service / src / main / java / org / onap / champ / ChampRESTAPI.java
index e9a2830..577dbc9 100644 (file)
@@ -205,6 +205,8 @@ public class ChampRESTAPI {
       response = Response.status(Status.BAD_REQUEST).entity("Unable to parse the payload").build();
     } catch (ChampServiceException ce) {
       response = Response.status(ce.getHttpStatus()).entity(ce.getMessage()).build();
+    } catch (IllegalArgumentException e) {
+      response = Response.status(Status.BAD_REQUEST).entity(e.getMessage()).build();
     } catch (Exception e) {
       response = Response.status(Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build();
       LoggingUtil.logInternalError(logger, e);
@@ -243,6 +245,8 @@ public class ChampRESTAPI {
       response = Response.status(Status.BAD_REQUEST).entity("Unable to parse the payload").build();
     } catch (ChampServiceException ce) {
       response = Response.status(ce.getHttpStatus()).entity(ce.getMessage()).build();
+    } catch (IllegalArgumentException e) {
+      response = Response.status(Status.BAD_REQUEST).entity(e.getMessage()).build();
     } catch (Exception e) {
       response = Response.status(Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build();
       LoggingUtil.logInternalError(logger, e);
@@ -387,6 +391,8 @@ public class ChampRESTAPI {
       response = Response.status(Status.BAD_REQUEST).entity("Unable to parse the payload").build();
     } catch (ChampServiceException ce) {
       response = Response.status(ce.getHttpStatus()).entity(ce.getMessage()).build();
+    } catch (IllegalArgumentException e) {
+      response = Response.status(Status.BAD_REQUEST).entity(e.getMessage()).build();
     } catch (Exception e) {
       response = Response.status(Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build();
       LoggingUtil.logInternalError(logger, e);
@@ -423,6 +429,8 @@ public class ChampRESTAPI {
       response = Response.status(Status.BAD_REQUEST).entity("Unable to parse the payload").build();
     } catch (ChampServiceException ce) {
       response = Response.status(ce.getHttpStatus()).entity(ce.getMessage()).build();
+    } catch (IllegalArgumentException e) {
+      response = Response.status(Status.BAD_REQUEST).entity(e.getMessage()).build();
     } catch (Exception e) {
       response = Response.status(Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build();
       LoggingUtil.logInternalError(logger, e);