aboutsummaryrefslogtreecommitdiffstats
path: root/participant/participant-impl/participant-impl-simulator/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'participant/participant-impl/participant-impl-simulator/src/main')
-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);
}
}