Commit #1
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
package com.example.nto.exception.handler;
|
||||
|
||||
import com.example.nto.exception.CodeNotFoundException;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
|
||||
@ControllerAdvice
|
||||
public class GlobalExceptionHandler {
|
||||
@ExceptionHandler(CodeNotFoundException.class)
|
||||
public ResponseEntity<Void> handleCodeNotFoundException(CodeNotFoundException e) {
|
||||
return new ResponseEntity<Void>(HttpStatus.UNAUTHORIZED);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user