X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=cps-ncmp-rest%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fcps%2Fncmp%2Frest%2Fexceptions%2FNetworkCmProxyRestExceptionHandler.java;h=2495f3642670c58967d26cd9c96f32e8eefe0d1f;hb=refs%2Fchanges%2F49%2F127149%2F24;hp=fd01096e19a8bb1f3351f4df3aeed8f1b15317da;hpb=d042fcdae75be100f840b6313e078eab278d87ef;p=cps.git diff --git a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/exceptions/NetworkCmProxyRestExceptionHandler.java b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/exceptions/NetworkCmProxyRestExceptionHandler.java index fd01096e1..2495f3642 100755 --- a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/exceptions/NetworkCmProxyRestExceptionHandler.java +++ b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/exceptions/NetworkCmProxyRestExceptionHandler.java @@ -30,6 +30,7 @@ import org.onap.cps.ncmp.rest.controller.NetworkCmProxyController; import org.onap.cps.ncmp.rest.controller.NetworkCmProxyInventoryController; import org.onap.cps.ncmp.rest.model.ErrorMessage; import org.onap.cps.spi.exceptions.CpsException; +import org.onap.cps.spi.exceptions.DataNodeNotFoundException; import org.onap.cps.spi.exceptions.DataValidationException; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -59,24 +60,19 @@ public class NetworkCmProxyRestExceptionHandler { return buildErrorResponse(HttpStatus.INTERNAL_SERVER_ERROR, exception); } - @ExceptionHandler({CpsException.class}) - public static ResponseEntity handleAnyOtherCpsExceptions(final CpsException exception) { + @ExceptionHandler({CpsException.class, ServerNcmpException.class}) + public static ResponseEntity handleAnyOtherCpsExceptions(final Exception exception) { return buildErrorResponse(HttpStatus.INTERNAL_SERVER_ERROR, exception); } - @ExceptionHandler({ServerNcmpException.class}) - public static ResponseEntity handleServerNcmpExceptions(final ServerNcmpException exception) { - return buildErrorResponse(HttpStatus.INTERNAL_SERVER_ERROR, exception); - } - - @ExceptionHandler({DmiRequestException.class}) - public static ResponseEntity handleDmiRequestExceptions(final DmiRequestException exception) { + @ExceptionHandler({DmiRequestException.class, DataValidationException.class, HttpMessageNotReadableException.class}) + public static ResponseEntity handleDmiRequestExceptions(final Exception exception) { return buildErrorResponse(HttpStatus.BAD_REQUEST, exception); } - @ExceptionHandler({DataValidationException.class, HttpMessageNotReadableException.class}) - public static ResponseEntity handleDataValidatedExceptions(final Exception exception) { - return buildErrorResponse(HttpStatus.BAD_REQUEST, exception); + @ExceptionHandler({DataNodeNotFoundException.class}) + public static ResponseEntity handleNotFoundExceptions(final CpsException exception) { + return buildErrorResponse(HttpStatus.NOT_FOUND, exception); } private static ResponseEntity buildErrorResponse(final HttpStatus status, final Exception exception) {