diff options
author | FrancescoFioraEst <francesco.fiora@est.tech> | 2021-10-18 17:12:39 +0100 |
---|---|---|
committer | Ajith Sreekumar <ajith.sreekumar@bell.ca> | 2021-10-19 15:43:21 +0000 |
commit | a9a5058eb33eda7d273bab5122736266980c99dc (patch) | |
tree | f7dc32772e18f8a9940145fdcf874722cf775b42 /participant/participant-impl | |
parent | abd179dcba2161fb5591c48d554b9a6637b37572 (diff) |
Refactor GlobalControllerExceptionHandler
Issue-ID: POLICY-3530
Change-Id: Ib33daf8491c1bf96460b424e8b0da228d65e571a
Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'participant/participant-impl')
-rw-r--r-- | participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/GlobalControllerExceptionHandler.java | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/GlobalControllerExceptionHandler.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/GlobalControllerExceptionHandler.java index 34b212305..8648c253e 100644 --- a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/GlobalControllerExceptionHandler.java +++ b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/GlobalControllerExceptionHandler.java @@ -23,11 +23,10 @@ package org.onap.policy.clamp.controlloop.participant.simulator.main.rest; import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException; -import org.onap.policy.clamp.controlloop.models.messages.rest.commissioning.CommissioningResponse; -import org.springframework.http.HttpStatus; +import org.onap.policy.clamp.controlloop.models.messages.rest.SimpleResponse; +import org.onap.policy.clamp.controlloop.models.rest.RestUtils; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.ExceptionHandler; -import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestControllerAdvice; @RestControllerAdvice @@ -40,12 +39,7 @@ public class GlobalControllerExceptionHandler { * @return ResponseEntity */ @ExceptionHandler(ControlLoopException.class) - @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) - public ResponseEntity<CommissioningResponse> handleBadRequest(ControlLoopException ex) { - - var resp = new CommissioningResponse(); - resp.setErrorDetails(ex.getErrorResponse().getErrorMessage()); - - return ResponseEntity.status(ex.getErrorResponse().getResponseCode().getStatusCode()).body(resp); + public ResponseEntity<SimpleResponse> handleBadRequest(ControlLoopException ex) { + return RestUtils.toSimpleResponse(ex); } } |