aboutsummaryrefslogtreecommitdiffstats
path: root/runtime-acm/src/main
diff options
context:
space:
mode:
authorFrancescoFioraEst <francesco.fiora@est.tech>2023-11-20 10:07:44 +0000
committerFrancescoFioraEst <francesco.fiora@est.tech>2023-11-20 15:15:18 +0000
commit61571e7b5119793bbbfb8942db5765d16fbd4fdf (patch)
tree2a84ca788caec28dd4435b18f264306ad5a4babc /runtime-acm/src/main
parent3276371eda89578e4fe3ad2ce348d1da6e22ff3f (diff)
Fix missing error message in ACM
Issue-ID: POLICY-4872 Change-Id: I2f7769a3bb1f6aa168f8d59ff99cb0774aee5ed7 Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'runtime-acm/src/main')
-rwxr-xr-xruntime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/web/RuntimeErrorController.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/web/RuntimeErrorController.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/web/RuntimeErrorController.java
index a7faf049d..5761d6948 100755
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/web/RuntimeErrorController.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/web/RuntimeErrorController.java
@@ -22,10 +22,11 @@
package org.onap.policy.clamp.acm.runtime.main.web;
+import static org.springframework.boot.web.error.ErrorAttributeOptions.Include;
+
import io.swagger.v3.oas.annotations.Hidden;
import jakarta.servlet.RequestDispatcher;
import jakarta.servlet.http.HttpServletRequest;
-import java.util.Map;
import org.onap.policy.clamp.models.acm.messages.rest.SimpleResponse;
import org.onap.policy.clamp.models.acm.messages.rest.TypedSimpleResponse;
import org.slf4j.Logger;
@@ -79,10 +80,14 @@ public class RuntimeErrorController implements ErrorController {
@SuppressWarnings("squid:S3752")
@RequestMapping(value = "${server.error.path}", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<TypedSimpleResponse<SimpleResponse>> handleError(HttpServletRequest request) {
- Map<String, Object> map = this.errorAttributes.getErrorAttributes(new ServletWebRequest(request),
- ErrorAttributeOptions.defaults());
+ var map = this.errorAttributes.getErrorAttributes(new ServletWebRequest(request),
+ ErrorAttributeOptions.of(Include.MESSAGE, Include.EXCEPTION, Include.BINDING_ERRORS));
var sb = new StringBuilder();
+ final var exception = map.get("exception");
+ if (exception != null) {
+ sb.append(exception).append(" ");
+ }
final var error = map.get("error");
if (error != null) {
sb.append(error).append(" ");