File tree Expand file tree Collapse file tree
src/main/java/br/com/developers/controller/handler Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010import br .com .developers .exception .ExistingEmailException ;
1111import br .com .developers .exception .IllegalRoleException ;
1212import br .com .developers .exception .RoleNotFoundException ;
13+ import br .com .developers .exception .UserNotFoundException ;
1314
1415@ ControllerAdvice
1516public class HandlerException extends ResponseEntityExceptionHandler {
@@ -41,6 +42,12 @@ public ResponseEntity<ApiException> handleRoleNotFoundException(RoleNotFoundExce
4142 .body (createResponse (ex .getMessage (), NOT_FOUND .value ()));
4243 }
4344
45+ @ ExceptionHandler (UserNotFoundException .class )
46+ public ResponseEntity <ApiException > handleUserNotFoundException (UserNotFoundException ex ) {
47+ return ResponseEntity .status (NOT_FOUND )
48+ .body (createResponse (ex .getMessage (), NOT_FOUND .value ()));
49+ }
50+
4451 private ApiException createResponse (String message , int httpValue ) {
4552 return new ApiException (message , httpValue );
4653 }
You can’t perform that action at this time.
0 commit comments