mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-22 22:27:55 +01:00
Handle validations exceptions.
This commit is contained in:
parent
0cbe108910
commit
d811c8f011
@ -67,10 +67,15 @@ public class BaseController {
|
|||||||
return ex.getMessage();
|
return ex.getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ExceptionHandler(ValidationException.class)
|
||||||
|
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
||||||
|
public RestErrors handleValidationErrors(@NotNull ValidationException ex) {
|
||||||
|
return new RestErrors(ex.getErrors(), messageSource);
|
||||||
|
}
|
||||||
|
|
||||||
@ExceptionHandler(JsonHttpMessageNotReadableException.class)
|
@ExceptionHandler(JsonHttpMessageNotReadableException.class)
|
||||||
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
||||||
public String handleValidationErrors(@NotNull JsonHttpMessageNotReadableException ex) {
|
public String handleJSONErrors(@NotNull JsonHttpMessageNotReadableException ex) {
|
||||||
return "Request could not be saved. Message is not valid";
|
return "Request could not be saved. Message is not valid";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user