summaryrefslogtreecommitdiffstats
path: root/participant
diff options
context:
space:
mode:
authorLiam Fallon <liam.fallon@est.tech>2021-10-20 08:13:39 +0000
committerGerrit Code Review <gerrit@onap.org>2021-10-20 08:13:39 +0000
commit962a9d16895c9ae75230cad5c7d8a1d4e453f2ad (patch)
tree9e08e148d793bc659a4cb73a1e3c8cf4145c6242 /participant
parent673011f7a96c1cdb326f1b4641465db0de568023 (diff)
parenta9a5058eb33eda7d273bab5122736266980c99dc (diff)
Merge "Refactor GlobalControllerExceptionHandler"
Diffstat (limited to 'participant')
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/GlobalControllerExceptionHandler.java14
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);
}
}