dev/2025-02-19-15-17

This commit is contained in:
geniy 2025-02-19 15:17:46 +03:00
parent dcfa7ab989
commit 5b44efc566

View File

@ -8,22 +8,22 @@ import org.springframework.web.bind.annotation.ExceptionHandler;
@ControllerAdvice
public class GlobalExceptionHandler {
@ExceptionHandler(CodeNotFoundException.class)
ResponseEntity<String> codeNotFoundExceptionHandler(NullPointerException e) {
ResponseEntity<String> codeNotFoundExceptionHandler(CodeNotFoundException e) {
return new ResponseEntity<>(e.getMessage(), HttpStatus.BAD_REQUEST);
}
@ExceptionHandler(EmployeeNotFoundException.class)
ResponseEntity<String> employeeNotFoundExceptionHandler(NullPointerException e) {
ResponseEntity<String> employeeNotFoundExceptionHandler(EmployeeNotFoundException e) {
return new ResponseEntity<>(e.getMessage(), HttpStatus.UNAUTHORIZED);
}
@ExceptionHandler(EmployeeDataNotFoundException.class)
ResponseEntity<String> employeeDataNotFoundExceptionHandler(NullPointerException e) {
ResponseEntity<String> employeeDataNotFoundExceptionHandler(EmployeeDataNotFoundException e) {
return new ResponseEntity<>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
}
@ExceptionHandler(EmployeeIsBlockedException.class)
ResponseEntity<String> employeeIsBlockedExceptionHandler(NullPointerException e) {
ResponseEntity<String> employeeIsBlockedExceptionHandler(EmployeeIsBlockedException e) {
return new ResponseEntity<>(e.getMessage(), HttpStatus.LOCKED);
}
}