-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #159 from AppLinkers/develop
Deploy for manage error code
- Loading branch information
Showing
37 changed files
with
446 additions
and
331 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
src/main/java/com/laser/ordermanage/common/exception/CommonErrorCode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package com.laser.ordermanage.common.exception; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import org.springframework.http.HttpStatus; | ||
|
||
@AllArgsConstructor | ||
@Getter | ||
public enum CommonErrorCode implements ErrorCode { | ||
|
||
// 400 BAD_REQUEST 잘못된 요청 | ||
BAD_REQUEST("COMMON_400_01", HttpStatus.BAD_REQUEST, "잘못된 요청입니다."), | ||
|
||
MISMATCH_PARAMETER_TYPE("COMMON_400_02", HttpStatus.BAD_REQUEST, " 파라미터의 타입이 올바르지 않습니다."), | ||
REQUIRED_PARAMETER("COMMON_400_03", HttpStatus.BAD_REQUEST, " 파라미터는 필수 입력값입니다."), | ||
INVALID_PARAMETER("COMMON_400_04", HttpStatus.BAD_REQUEST, " 파라미터가 올바르지 않습니다."), | ||
|
||
INVALID_REQUEST_BODY_FIELDS("COMMON_400_05", HttpStatus.BAD_REQUEST, ""), | ||
REQUIRED_REQUEST_BODY("COMMON_400_06", HttpStatus.BAD_REQUEST, "Request Body 가 필요한 요청 입니다."), | ||
|
||
REQUIRED_COOKIE("COMMON_400_07", HttpStatus.BAD_REQUEST, " 쿠키값이 존재하지 않습니다."), | ||
|
||
// 401 UNAUTHORIZED 인증 자격 정보가 유효하지 않음 | ||
UNAUTHORIZED("COMMON_401_01", HttpStatus.UNAUTHORIZED, "인증 자격 정보가 유효하지 않습니다."), | ||
|
||
// 403 FORBIDDEN 인증 필요 | ||
FORBIDDEN("COMMON_403_01", HttpStatus.FORBIDDEN, "인증이 필요합니다."), | ||
|
||
// 404 NOT_FOUND 리소스가 존재하지 않음 | ||
NOT_FOUND("COMMON_404_01", HttpStatus.NOT_FOUND, "리소스가 존재하지 않습니다."), | ||
|
||
// 405 METHOD_NOT_ALLOWED 허용하지 않은 Http Method | ||
METHOD_NOT_ALLOWED("COMMON_405_01", HttpStatus.METHOD_NOT_ALLOWED, "해당 요청에는 지원하지 않은 HTTP 메서드 입니다."), | ||
|
||
// 413 PAYLOAD_TOO_LARGE | ||
REQUEST_SIZE_EXCEEDED("COMMON_413_01", HttpStatus.PAYLOAD_TOO_LARGE, "요청의 크기가 100MB를 초과합니다."), | ||
REQUEST_FILE_SIZE_EXCEEDED("COMMON_413_02", HttpStatus.PAYLOAD_TOO_LARGE, "요청 파일의 크기가 100MB를 초과합니다."), | ||
|
||
// 500 INTERNAL SERVER ERROR 서버 에러 | ||
INTERNAL_SERVER_ERROR("COMMON_500_01", HttpStatus.INTERNAL_SERVER_ERROR, "서버 에러 입니다."), | ||
UNKNOWN_ERROR("COMMON_500_02", HttpStatus.INTERNAL_SERVER_ERROR, "알 수 없는 오류가 발생했습니다."), | ||
UNABLE_TO_SEND_EMAIL("COMMON_500_03", HttpStatus.INTERNAL_SERVER_ERROR, "메일 전송이 불가능합니다."), | ||
UNABLE_TO_AWS_S3_UPLOAD("COMMON_500_04", HttpStatus.INTERNAL_SERVER_ERROR, "AWS S3 에 파일 업로드가 불가능합니다."), | ||
UNABLE_TO_EXTRACT_THUMBNAIL("COMMON_500_05", HttpStatus.INTERNAL_SERVER_ERROR, "썸네일 추출이 불가능합니다."); | ||
|
||
private final String code; | ||
private final HttpStatus httpStatus; | ||
private final String message; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 4 additions & 66 deletions
70
src/main/java/com/laser/ordermanage/common/exception/ErrorCode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,9 @@ | ||
package com.laser.ordermanage.common.exception; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import org.springframework.http.HttpStatus; | ||
|
||
@AllArgsConstructor | ||
@Getter | ||
public enum ErrorCode { | ||
|
||
// 400 BAD_REQUEST 잘못된 요청 | ||
BAD_REQUEST("-000", HttpStatus.BAD_REQUEST, "잘못된 요청입니다."), | ||
MISSING_JWT_TOKEN("-001", HttpStatus.BAD_REQUEST, "JWT 토큰 정보가 요청에 포함되지 않았습니다."), | ||
INVALID_CREDENTIALS("-002", HttpStatus.BAD_REQUEST, "ID 또는 비밀번호가 올바르지 않습니다."), | ||
|
||
INVALID_PARAMETER("-003", HttpStatus.BAD_REQUEST, " 파라미터가 올바르지 않습니다."), | ||
INVALID_PARAMETER_TYPE("-004", HttpStatus.BAD_REQUEST, " 파라미터의 타입이 올바르지 않습니다."), | ||
INVALID_FIELDS("-005", HttpStatus.BAD_REQUEST, ""), | ||
|
||
MISSING_COOKIE("-006", HttpStatus.BAD_REQUEST, " 쿠키값이 존재하지 않습니다."), | ||
MISSING_QUERY_PARAMETER("-007", HttpStatus.BAD_REQUEST, " 쿼리 파라미터 값이 존재하지 않습니다."), | ||
|
||
REQUEST_FILE_SIZE_EXCEED("-008", HttpStatus.BAD_REQUEST, "요청 파일의 크기가 100MB를 초과합니다."), | ||
INVALID_FILE_EXTENSION("-009", HttpStatus.BAD_REQUEST, "지원하지 않는 파일 형식입니다."), | ||
INVALID_INGREDIENT("-010", HttpStatus.BAD_REQUEST, "지원하지 않는 재료입니다."), | ||
INVALID_ORDER_STAGE("-011", HttpStatus.BAD_REQUEST, " 단계의 거래는 해당 요청을 수행할 수 없습니다."), | ||
LAST_DRAWING_DELETE("-012", HttpStatus.BAD_REQUEST, "거래에는 최소 하나의 도면이 필요합니다.마지막 도면은 삭제할 수 없습니다."), | ||
MISSING_QUOTATION_FILE("-013", HttpStatus.BAD_REQUEST, "견적서 최초 작성 시, 견적서 파일은 필수 사항입니다."), | ||
MISSING_QUOTATION("-014", HttpStatus.BAD_REQUEST, "거래의 견적서가 존재하지 않습니다."), | ||
MISSING_PURCHASE_ORDER("-015", HttpStatus.BAD_REQUEST, "거래의 발주서가 존재하지 않습니다."), | ||
DEFAULT_DELIVERY_ADDRESS_DELETE("-016", HttpStatus.BAD_REQUEST, "기본 배송지는 삭제할 수 없습니다."), | ||
MISSING_PURCHASE_ORDER_FILE("-017", HttpStatus.BAD_REQUEST, "발주서 최초 작성 시, 발주서 파일은 필수 사항입니다."), | ||
|
||
// 401 UNAUTHORIZED 인증 자격 정보가 유효하지 않음 | ||
UNAUTHORIZED("-100", HttpStatus.UNAUTHORIZED, "인증 자격 정보가 유효하지 않습니다."), | ||
INVALID_JWT_TOKEN("-101", HttpStatus.UNAUTHORIZED, "JWT Token 정보가 유효하지 않습니다."), | ||
EXPIRED_JWT_TOKEN("-102", HttpStatus.UNAUTHORIZED, "JWT 토큰 정보가 만료되었습니다."), | ||
UNSUPPORTED_JWT_TOKEN("-103", HttpStatus.UNAUTHORIZED, "지원되지 않는 JWT 토큰 입니다."), | ||
UNAUTHORIZED_JWT_TOKEN("-104", HttpStatus.UNAUTHORIZED, "JWT 토큰에 권한정보가 존재하지 않습니다."), | ||
|
||
INVALID_ACCESS_JWT_TOKEN("-105", HttpStatus.UNAUTHORIZED, "Access JWT 토큰 정보가 유효하지 않습니다."), | ||
INVALID_REFRESH_JWT_TOKEN("-106", HttpStatus.UNAUTHORIZED, "Refresh JWT 토큰 정보가 유효하지 않습니다."), | ||
|
||
INVALID_VERIFY_CODE("-107", HttpStatus.UNAUTHORIZED, "인증 코드 정보가 유효하지 않습니다."), | ||
|
||
INVALID_CHANGE_PASSWORD_JWT_TOKEN("-108", HttpStatus.UNAUTHORIZED, "Change Password JWT 토큰 정보가 유효하지 않습니다."), | ||
|
||
// 403 FORBIDDEN 인증 필요 | ||
FORBIDDEN("-300", HttpStatus.FORBIDDEN, "인증이 필요합니다."), | ||
DENIED_ACCESS("-301", HttpStatus.FORBIDDEN, "해당 요청에 대한 접근 권한이 없습니다."), | ||
DENIED_ACCESS_TO_ENTITY("-302", HttpStatus.FORBIDDEN, " 엔티티에 접근 권한이 없습니다."), | ||
|
||
// 404 NOT_FOUND 리소스가 존재하지 않음 | ||
NOT_FOUND("-400", HttpStatus.NOT_FOUND, "리소스가 존재하지 않습니다."), | ||
NOT_FOUND_VERIFY_CODE("-401", HttpStatus.NOT_FOUND, "이메일에 해당하는 인증 코드가 존재하지 않습니다."), | ||
NOT_FOUND_ENTITY("-402", HttpStatus.NOT_FOUND, " 엔티티가 존재하지 않습니다."), | ||
|
||
// 405 METHOD_NOT_ALLOWED 허용하지 않은 Http Method | ||
METHOD_NOT_ALLOWED("-405", HttpStatus.METHOD_NOT_ALLOWED, "해당 요청에는 지원하지 않은 HTTP 메서드 입니다."), | ||
|
||
// 500 INTERNAL SERVER ERROR 서버 에러 | ||
INTERNAL_SERVER_ERROR("-500", HttpStatus.INTERNAL_SERVER_ERROR, "서버 에러 입니다."), | ||
UNKNOWN_ERROR("-501", HttpStatus.INTERNAL_SERVER_ERROR, "알 수 없는 오류가 발생했습니다."), | ||
UNABLE_TO_SEND_EMAIL("-502", HttpStatus.INTERNAL_SERVER_ERROR, "메일 전송이 불가능합니다."), | ||
UNABLE_TO_AWS_S3_UPLOAD("-503", HttpStatus.INTERNAL_SERVER_ERROR, "AWS S3 에 파일 업로드가 불가능합니다."), | ||
UNABLE_TO_EXTRACT_THUMBNAIL("-504", HttpStatus.INTERNAL_SERVER_ERROR, "썸네일 추출이 불가능합니다."); | ||
|
||
private final String code; | ||
private final HttpStatus httpStatus; | ||
private final String message; | ||
public interface ErrorCode { | ||
String getCode(); | ||
HttpStatus getHttpStatus(); | ||
String getMessage(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
src/main/java/com/laser/ordermanage/common/exception/dto/response/ErrorResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,9 @@ | ||
package com.laser.ordermanage.common.exception.dto.response; | ||
|
||
import lombok.Builder; | ||
import org.springframework.http.HttpStatus; | ||
|
||
@Builder | ||
public record ErrorResponse ( | ||
HttpStatus httpStatus, | ||
String errorCode, | ||
String message | ||
) { } |
Oops, something went wrong.