package fr.natan.akkastreamfileprocessingapi.exceptionshandler; import fr.natan.akkastreamfileprocessingapi.businessexceptions.FileNotFoundException; import fr.natan.akkastreamfileprocessingapi.businessexceptions.MovieNotFoundException; 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 BusinessExceptionHandler { @ExceptionHandler(value = FileNotFoundException.class) private ResponseEntity FileNotFoundException(){ return new ResponseEntity<>("The File Is Not Found Exception", HttpStatus.NOT_FOUND); } @ExceptionHandler(value = MovieNotFoundException.class) private ResponseEntity handleMovieNotFoundException(){ return new ResponseEntity<>("Movie Title Not Found Exception", HttpStatus.NOT_FOUND); } }