Done ticket BE-24,25

This commit is contained in:
rajesh
2024-09-16 20:20:32 +05:30
parent e81e62cebb
commit c655e8c577
13 changed files with 66 additions and 34 deletions

View File

@@ -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) {

View File

@@ -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;
}