Skip to content

Commit

Permalink
feat: edit exception message
Browse files Browse the repository at this point in the history
  • Loading branch information
ray-yhc committed Oct 19, 2023
1 parent 05ba80d commit 539086b
Showing 1 changed file with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ protected ResponseEntity<Object> handleMethodArgumentNotValid(MethodArgumentNotV
Set<FieldError> fieldErrors = new HashSet<>(e.getBindingResult().getFieldErrors());
fieldErrors
.forEach(error -> {
sb.append(error.getField()).append(" : ").append(error.getDefaultMessage()).append("\n");
sb.append(error.getDefaultMessage()).append("\n");
});
// other errors info
e.getBindingResult().getAllErrors()
Expand All @@ -63,10 +63,6 @@ protected ResponseEntity<Object> handleMethodArgumentNotValid(MethodArgumentNotV
sb.append(error.getDefaultMessage()).append("\n");
});

// request info
sb.append("(").append(request.getDescription(false)).append(")");


GeneralException ge = new GeneralException(ResponseCode.VALIDATION_ERROR, sb.toString(), e.getCause());
return handleExceptionInternal(ge, ge.getResponseCode(), request);
}
Expand Down

0 comments on commit 539086b

Please sign in to comment.