Нет описания

BusinessExceptionHandler.java 976B

1234567891011121314151617181920212223
  1. package fr.natan.akkastreamfileprocessingapi.exceptionshandler;
  2. import fr.natan.akkastreamfileprocessingapi.businessexceptions.FileNotFoundException;
  3. import fr.natan.akkastreamfileprocessingapi.businessexceptions.TvSerieNotFoundException;
  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 = TvSerieNotFoundException.class)
  15. private ResponseEntity<String> handleTvSerieNotFoundException(){
  16. return new ResponseEntity<>("Movie Title Not Found Exception", HttpStatus.NOT_FOUND);
  17. }
  18. }

Powered by TurnKey Linux.