Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[issue84] [FIX] BaseException's abstract #85

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
package com.tinuproject.tinu.domain.exception.base

import com.fasterxml.jackson.databind.ser.Serializers.Base
import com.tinuproject.tinu.domain.exception.token.TokenErrorCode
import java.lang.RuntimeException

open class BaseException(
protected val tokenErrorCode : TokenErrorCode
protected val errorCode : ErrorCode
): RuntimeException(), BaseErrorCode {

override fun getResponse(): ResponseDTO {
var map : MutableMap<String, Any> = mutableMapOf()
map["error-message"] = tokenErrorCode.message
map["stateCode"] = tokenErrorCode.stateCode
return ResponseDTO(isSuccess = false, httpStatusCode = tokenErrorCode.httpStatusCode, result = map)
map["error-message"] = errorCode.message
if(errorCode.stateCode!=null) map["stateCode"] = errorCode.stateCode
return ResponseDTO(isSuccess = false, httpStatusCode = errorCode.httpStatusCode, result = map)
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package com.tinuproject.tinu.domain.exception.token
package com.tinuproject.tinu.domain.exception.base

import com.tinuproject.tinu.domain.exception.base.BaseErrorCode

enum class TokenErrorCode(
enum class ErrorCode(
val httpStatusCode : Int,
val stateCode : String,
val stateCode : String?,
val message :String
) {
TOKEN_MISSING(httpStatusCode = 401, stateCode = "TOKEN_MISSING", message = "토큰이 존재하지 않습니다."),
TOKEN_INVALIDED(httpStatusCode = 401, stateCode = "TOKEN_INVALIDED", message = "토큰이 유효하지 않습니다."),
TOKEN_EXPIRED(httpStatusCode = 401, stateCode = "TOKEN_EXPIRED", message = "토큰이 만료되었습니다.");


}