Files
NTO-2025-Backend-TeamTask/src/main/java/com/example/nto/exception/handler/GlobalExceptionHandler.java
2025-11-21 21:39:00 +03:00

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);
}
}