16 lines
587 B
Java
16 lines
587 B
Java
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<>(HttpStatus.UNAUTHORIZED);
|
|
}
|
|
}
|