-
Notifications
You must be signed in to change notification settings - Fork 2
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
2 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
raisedragon-core/src/main/kotlin/com/whatever/raisedragon/common/exception/BaseException.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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.whatever.raisedragon.common.exception | ||
|
||
class BaseException( | ||
val exceptionCode: ExceptionCode, | ||
override val message: String, | ||
override val cause: Throwable?, | ||
) : RuntimeException( | ||
message, | ||
cause | ||
) { | ||
|
||
companion object { | ||
fun of( | ||
exceptionCode: ExceptionCode, | ||
executionMessage: String, | ||
cause: Throwable? = null | ||
): BaseException { | ||
return BaseException( | ||
exceptionCode = exceptionCode, | ||
message = executionMessage, | ||
cause = cause | ||
) | ||
} | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
raisedragon-core/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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.whatever.raisedragon.common.exception | ||
|
||
import org.springframework.http.HttpStatus | ||
|
||
enum class ExceptionCode( | ||
val httpStatus: HttpStatus, | ||
val code: String, | ||
val message: String, | ||
) { | ||
|
||
E400_BAD_REQUEST(HttpStatus.BAD_REQUEST, "000", "필수 파라미터 값이 없거나 잘못된 값으로 요청을 보낸 경우 발생"), | ||
|
||
// ------------------------------ 401 ------------------------------ | ||
E401_UNAUTHORIZED(HttpStatus.UNAUTHORIZED, "000", "유효하지 않은 인증 토큰을 사용한 경우 발생"), | ||
|
||
// ------------------------------ 403 ------------------------------ | ||
E403_FORBIDDEN(HttpStatus.FORBIDDEN, "000", "사용 권한이 없는 경우 발생"), | ||
|
||
// ------------------------------ 404 ------------------------------ | ||
E404_NOT_FOUND(HttpStatus.NOT_FOUND, "000", "요청한 리소스가 존재하지 않는 경우 발생"), | ||
|
||
// ------------------------------ 405 ------------------------------ | ||
E405_METHOD_NOT_ALLOWED(HttpStatus.METHOD_NOT_ALLOWED, "000", "HTTP Method가 잘못된 경우"), | ||
|
||
// ------------------------------ 409 ------------------------------ | ||
E409_CONFLICT(HttpStatus.CONFLICT, "000", "요청한 리소스가 중복된 경우 발생"), | ||
|
||
// ------------------------------ 500 ------------------------------ | ||
E500_INTERNAL_SERVER_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, "000", "서버 내부에 문제 발생"), | ||
|
||
// ------------------------------ 501 ------------------------------ | ||
E501_NOT_IMPLEMENTED(HttpStatus.NOT_IMPLEMENTED, "000", "지원하지 않는 타입의 요청"), | ||
} |