RED-5293: fixed broken IllegalArgumentException, it throws now a 400 instead of 500

This commit is contained in:
Ali Oezyetimoglu 2022-11-09 09:46:26 +01:00
parent 9b7d1536eb
commit d95beeae26

View File

@ -106,4 +106,12 @@ public class ControllerAdvice {
return new ErrorMessage(OffsetDateTime.now(), String.format("You have empty/wrong formatted parameters: %s", errorListAsString));
}
@ResponseBody
@ResponseStatus(value = HttpStatus.BAD_REQUEST)
@ExceptionHandler(value = IllegalArgumentException.class)
public ErrorMessage handleIllegalArgumentException(IllegalArgumentException e) {
return new ErrorMessage(OffsetDateTime.now(), e.getMessage());
}
}