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 handleCodeNotFoundException(CodeNotFoundException e) { return new ResponseEntity<>(HttpStatus.UNAUTHORIZED); } }