From 961fedf69bdee6b9cb18e46cd6936732f65a2413 Mon Sep 17 00:00:00 2001 From: Dayeon-Hong Date: Sun, 12 May 2024 18:38:08 +0900 Subject: [PATCH] =?UTF-8?q?feat=20:=20=ED=95=AD=EA=B3=B5=EA=B6=8C=20?= =?UTF-8?q?=EA=B4=80=EB=A0=A8=20error=20=EC=BD=94=EB=93=9C=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #45 #40 --- .../isp/backend/global/exception/ErrorCode.java | 11 ++++++++++- .../exception/flight/FlightNotFoundException.java | 10 ++++++++++ .../flight/FlightSearchFailedException.java | 12 ++++++++++++ .../exception/flight/NotYourFlightException.java | 14 ++++++++++++++ .../flight/SkyScannerGenerateFailedException.java | 12 ++++++++++++ .../schedule/IataCodeNotFoundException.java | 12 ++++++++++++ 6 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 backend/src/main/java/com/isp/backend/global/exception/flight/FlightNotFoundException.java create mode 100644 backend/src/main/java/com/isp/backend/global/exception/flight/FlightSearchFailedException.java create mode 100644 backend/src/main/java/com/isp/backend/global/exception/flight/NotYourFlightException.java create mode 100644 backend/src/main/java/com/isp/backend/global/exception/flight/SkyScannerGenerateFailedException.java create mode 100644 backend/src/main/java/com/isp/backend/global/exception/schedule/IataCodeNotFoundException.java diff --git a/backend/src/main/java/com/isp/backend/global/exception/ErrorCode.java b/backend/src/main/java/com/isp/backend/global/exception/ErrorCode.java index 1e9bf4c7..0a9ea727 100644 --- a/backend/src/main/java/com/isp/backend/global/exception/ErrorCode.java +++ b/backend/src/main/java/com/isp/backend/global/exception/ErrorCode.java @@ -15,10 +15,19 @@ public enum ErrorCode { MEMBER_NOT_ACTIVATED(HttpStatus.BAD_REQUEST, "U003", "사용자가 활성화 상태가 아닙니다."), ACCESS_TOKEN_IS_INVALID(HttpStatus.UNAUTHORIZED, "U004", "엑세스 토큰이 유효하지 않습니다."), REFRESH_TOKEN_IS_INVALID(HttpStatus.UNAUTHORIZED, "U005", "리프레시 토큰이 유효하지 않습니다."), + + // Schedule COUNTRY_NOT_FOUND(HttpStatus.NOT_FOUND, "S001", "여행할 국가를 찾을 수 없습니다."), SCHEDULE_NOT_FOUND(HttpStatus.NOT_FOUND, "S002", "여행 일정을 찾을 수 없습니다."), NOT_YOUR_SCHEDULE(HttpStatus.UNAUTHORIZED, "S003", "사용자의 여행 일정이 아닙니다."), - IMAGE_NOT_FOUND(HttpStatus.NOT_FOUND, "S004", "이미지를 찾을 수 없습니다."); + IMAGE_NOT_FOUND(HttpStatus.NOT_FOUND, "S004", "이미지를 찾을 수 없습니다."), + IATA_CODE_NOT_FOUND(HttpStatus.NOT_FOUND, "S005", "해당 국가의 공항 코드를 찾을 수 없습니다."), + + // Flight + FLIGHT_SEARCH_FAILED(HttpStatus.INTERNAL_SERVER_ERROR,"F001", "힝공편 조회를 가져오는 중 오류를 발생했습니다."), + SKY_SCANNER_GENERATE_FAILED(HttpStatus.INTERNAL_SERVER_ERROR,"F002", "스카이스캐너 URL을 생성할 수 없습니다."), + FLIGHT_NOT_FOUND(HttpStatus.NOT_FOUND, "F003", "해당 id의 항공권을 찾을 수 없습니다."), + NOT_YOUR_FLIGHT(HttpStatus.UNAUTHORIZED, "F004", "사용자의 항공권이 아닙니다"); private HttpStatus status; diff --git a/backend/src/main/java/com/isp/backend/global/exception/flight/FlightNotFoundException.java b/backend/src/main/java/com/isp/backend/global/exception/flight/FlightNotFoundException.java new file mode 100644 index 00000000..905542a0 --- /dev/null +++ b/backend/src/main/java/com/isp/backend/global/exception/flight/FlightNotFoundException.java @@ -0,0 +1,10 @@ +package com.isp.backend.global.exception.flight; + +import com.isp.backend.global.exception.CustomException; +import com.isp.backend.global.exception.ErrorCode; + +public class FlightNotFoundException extends CustomException { + + public FlightNotFoundException() {super(ErrorCode.FLIGHT_NOT_FOUND);} + +} diff --git a/backend/src/main/java/com/isp/backend/global/exception/flight/FlightSearchFailedException.java b/backend/src/main/java/com/isp/backend/global/exception/flight/FlightSearchFailedException.java new file mode 100644 index 00000000..2d53046f --- /dev/null +++ b/backend/src/main/java/com/isp/backend/global/exception/flight/FlightSearchFailedException.java @@ -0,0 +1,12 @@ +package com.isp.backend.global.exception.flight; + +import com.isp.backend.global.exception.CustomException; +import com.isp.backend.global.exception.ErrorCode; + +public class FlightSearchFailedException extends CustomException { + + public FlightSearchFailedException() { + super(ErrorCode.FLIGHT_SEARCH_FAILED); + } + +} \ No newline at end of file diff --git a/backend/src/main/java/com/isp/backend/global/exception/flight/NotYourFlightException.java b/backend/src/main/java/com/isp/backend/global/exception/flight/NotYourFlightException.java new file mode 100644 index 00000000..7c80919e --- /dev/null +++ b/backend/src/main/java/com/isp/backend/global/exception/flight/NotYourFlightException.java @@ -0,0 +1,14 @@ +package com.isp.backend.global.exception.flight; + +import com.isp.backend.global.exception.CustomException; +import com.isp.backend.global.exception.ErrorCode; + +public class NotYourFlightException extends CustomException { + + public NotYourFlightException() { + super(ErrorCode.NOT_YOUR_FLIGHT); + } + +} + + diff --git a/backend/src/main/java/com/isp/backend/global/exception/flight/SkyScannerGenerateFailedException.java b/backend/src/main/java/com/isp/backend/global/exception/flight/SkyScannerGenerateFailedException.java new file mode 100644 index 00000000..08a5faf4 --- /dev/null +++ b/backend/src/main/java/com/isp/backend/global/exception/flight/SkyScannerGenerateFailedException.java @@ -0,0 +1,12 @@ +package com.isp.backend.global.exception.flight; + +import com.isp.backend.global.exception.CustomException; +import com.isp.backend.global.exception.ErrorCode; + +public class SkyScannerGenerateFailedException extends CustomException { + + public SkyScannerGenerateFailedException() { + super(ErrorCode.SKY_SCANNER_GENERATE_FAILED); + } + +} \ No newline at end of file diff --git a/backend/src/main/java/com/isp/backend/global/exception/schedule/IataCodeNotFoundException.java b/backend/src/main/java/com/isp/backend/global/exception/schedule/IataCodeNotFoundException.java new file mode 100644 index 00000000..e849f994 --- /dev/null +++ b/backend/src/main/java/com/isp/backend/global/exception/schedule/IataCodeNotFoundException.java @@ -0,0 +1,12 @@ +package com.isp.backend.global.exception.schedule; + +import com.isp.backend.global.exception.CustomException; +import com.isp.backend.global.exception.ErrorCode; + +public class IataCodeNotFoundException extends CustomException { + + public IataCodeNotFoundException() { + super(ErrorCode.IATA_CODE_NOT_FOUND); + } + +}