Done ticket BE-24,25
This commit is contained in:
@@ -34,6 +34,15 @@ public class GlobalExceptionHandler {
|
||||
log.error(ex.getLocalizedMessage(), ex);
|
||||
return new Response<>(null, ex.getStatus(), ex.getMessage());
|
||||
}
|
||||
|
||||
@ResponseStatus(value = HttpStatus.BAD_REQUEST)
|
||||
@ExceptionHandler(ValidationException.class)
|
||||
@ResponseBody
|
||||
public Response<Object> handleValidationException(final ValidationException ex) {
|
||||
log.error(ex.getMessage());
|
||||
log.error(ex.getLocalizedMessage(), ex);
|
||||
return new Response<>(ex.getErrors(), ex.getStatus(), ex.getMessage());
|
||||
}
|
||||
|
||||
@ExceptionHandler(ResourceNotFoundException.class)
|
||||
public ResponseEntity<Response<Void>> handleResourceNotFoundException(ResourceNotFoundException ex) {
|
||||
|
||||
@@ -2,14 +2,14 @@ package net.gepafin.tendermanagement.web.rest.api.errors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ValidationException extends CustomValidationException {
|
||||
public class ValidationException extends CustomValidationException {
|
||||
|
||||
private final Status status;
|
||||
private static final long serialVersionUID = 1L;
|
||||
private final List<String> errors;
|
||||
|
||||
public ValidationException(Status status, List<String> errors) {
|
||||
super(status, errors.toString());
|
||||
public ValidationException(Status status, List<String> errors, String message) {
|
||||
super(status, message);
|
||||
this.errors = errors;
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user