Нет описания

BusinessExceptionHandler.java 969B

12345678910111213141516171819202122
  1. package fr.natan.akkastreamfileprocessingapi.exceptionshandler;
  2. import fr.natan.akkastreamfileprocessingapi.businessexceptions.FileNotFoundException;
  3. import fr.natan.akkastreamfileprocessingapi.businessexceptions.MovieNotFoundException;
  4. import org.springframework.http.HttpStatus;
  5. import org.springframework.http.ResponseEntity;
  6. import org.springframework.web.bind.annotation.ControllerAdvice;
  7. import org.springframework.web.bind.annotation.ExceptionHandler;
  8. @ControllerAdvice
  9. public class BusinessExceptionHandler {
  10. @ExceptionHandler(value = FileNotFoundException.class)
  11. private ResponseEntity<String> FileNotFoundException(){
  12. return new ResponseEntity<>("The File Is Not Found Exception", HttpStatus.NOT_FOUND);
  13. }
  14. @ExceptionHandler(value = MovieNotFoundException.class)
  15. private ResponseEntity<String> handleMovieNotFoundException(){
  16. return new ResponseEntity<>("Movie Title Not Found Exception", HttpStatus.NOT_FOUND);
  17. }
  18. }

Powered by TurnKey Linux.