forked from whatever-mentoring/GoalBetting-Server
-
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.
- Loading branch information
Showing
10 changed files
with
48 additions
and
62 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
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
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
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
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
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
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
31 changes: 12 additions & 19 deletions
31
...edragon-common/src/main/kotlin/com/whatever/raisedragon/common/exception/ExceptionCode.kt
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,40 +1,33 @@ | ||
package com.whatever.raisedragon.common.exception | ||
|
||
import org.springframework.http.HttpStatus | ||
|
||
enum class ExceptionCode( | ||
val httpStatus: HttpStatus, | ||
val code: String, | ||
val httpStatusCode: Int, | ||
val message: String, | ||
) { | ||
|
||
E400_BAD_REQUEST(HttpStatus.BAD_REQUEST, "400", "필수 파라미터 값이 없거나 잘못된 값으로 요청을 보낸 경우 발생"), | ||
E400_BAD_REQUEST( 400, "필수 파라미터 값이 없거나 잘못된 값으로 요청을 보낸 경우 발생"), | ||
|
||
// ------------------------------ 401 ------------------------------ | ||
E401_UNAUTHORIZED(HttpStatus.UNAUTHORIZED, "401", "유효하지 않은 인증 토큰을 사용한 경우 발생"), | ||
E401_UNAUTHORIZED(401, "유효하지 않은 인증 토큰을 사용한 경우 발생"), | ||
|
||
// ------------------------------ 403 ------------------------------ | ||
E403_FORBIDDEN(HttpStatus.FORBIDDEN, "403", "사용 권한이 없는 경우 발생"), | ||
E403_FORBIDDEN(403, "사용 권한이 없는 경우 발생"), | ||
|
||
// ------------------------------ 404 ------------------------------ | ||
E404_NOT_FOUND(HttpStatus.NOT_FOUND, "404", "요청한 리소스가 존재하지 않는 경우 발생"), | ||
E404_NOT_FOUND(404, "요청한 리소스가 존재하지 않는 경우 발생"), | ||
|
||
// ------------------------------ 405 ------------------------------ | ||
E405_METHOD_NOT_ALLOWED(HttpStatus.METHOD_NOT_ALLOWED, "405", "HTTP Method가 잘못된 경우"), | ||
E405_METHOD_NOT_ALLOWED(405, "HTTP Method가 잘못된 경우"), | ||
|
||
// ------------------------------ 409 ------------------------------ | ||
E409_CONFLICT(HttpStatus.CONFLICT, "409", "요청한 리소스가 중복된 경우 발생"), | ||
E409_CONFLICT(409, "요청한 리소스가 중복된 경우 발생"), | ||
|
||
// ------------------------------ 500 ------------------------------ | ||
E500_INTERNAL_SERVER_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, "500", "서버 내부에 문제 발생"), | ||
E500_INTERNAL_SERVER_ERROR(500, "서버 내부에 문제 발생"), | ||
|
||
// ------------------------------ 501 ------------------------------ | ||
E501_NOT_IMPLEMENTED(HttpStatus.NOT_IMPLEMENTED, "501", "지원하지 않는 타입의 요청"), | ||
} | ||
E501_NOT_IMPLEMENTED(501, "지원하지 않는 타입의 요청"); | ||
|
||
fun ExceptionCode.throwAsException() { | ||
throw BaseException.of( | ||
exceptionCode = this, | ||
executionMessage = message | ||
) | ||
} | ||
val errorCode: String | ||
get() = httpStatusCode.toString() | ||
} |
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
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,4 +1,7 @@ | ||
dependencies { | ||
// aws | ||
implementation("org.springframework.cloud:spring-cloud-starter-aws:2.2.6.RELEASE") | ||
} | ||
|
||
// RestTemplate | ||
implementation("org.springframework:spring-webmvc") | ||
} |