From 2b305d2d488a7ed1c63022ff4241ad5fa588822d Mon Sep 17 00:00:00 2001 From: Nitin Vavdiya Date: Fri, 1 Sep 2023 11:53:08 +0530 Subject: [PATCH] feat: error msg updated --- .../managedidentitywallets/config/ExceptionHandling.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/eclipse/tractusx/managedidentitywallets/config/ExceptionHandling.java b/src/main/java/org/eclipse/tractusx/managedidentitywallets/config/ExceptionHandling.java index 21f27230e..408633976 100644 --- a/src/main/java/org/eclipse/tractusx/managedidentitywallets/config/ExceptionHandling.java +++ b/src/main/java/org/eclipse/tractusx/managedidentitywallets/config/ExceptionHandling.java @@ -119,7 +119,7 @@ ProblemDetail handleBadDataException(BadDataException e) { */ @ExceptionHandler(MethodArgumentNotValidException.class) ProblemDetail handleValidation(MethodArgumentNotValidException e) { - ProblemDetail problemDetail = ProblemDetail.forStatusAndDetail(HttpStatus.BAD_REQUEST, e.getMessage()); + ProblemDetail problemDetail = ProblemDetail.forStatusAndDetail(HttpStatus.BAD_REQUEST, ExceptionUtils.getMessage(e)); problemDetail.setTitle("Invalid data provided"); problemDetail.setProperty(TIMESTAMP, System.currentTimeMillis()); problemDetail.setProperty("errors", handleValidationError(e.getFieldErrors())); @@ -134,7 +134,7 @@ ProblemDetail handleValidation(MethodArgumentNotValidException e) { */ @ExceptionHandler(ConstraintViolationException.class) ProblemDetail handleValidation(ConstraintViolationException exception) { - ProblemDetail problemDetail = ProblemDetail.forStatusAndDetail(HttpStatus.BAD_REQUEST, exception.getMessage()); + ProblemDetail problemDetail = ProblemDetail.forStatusAndDetail(HttpStatus.BAD_REQUEST, ExceptionUtils.getMessage(exception)); problemDetail.setTitle("Invalid data provided"); problemDetail.setProperty(TIMESTAMP, System.currentTimeMillis()); problemDetail.setProperty("errors", exception.getConstraintViolations().stream().map(ConstraintViolation::getMessage).toList());