Skip to content

Commit

Permalink
✨ Refresh 토큰 만료 응답 Exception Handler 별도 처리
Browse files Browse the repository at this point in the history
  • Loading branch information
waterfogSW committed Oct 27, 2024
1 parent f471d1e commit 2ffc510
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.threedays.bootstrap.api.support.exception

import com.threedays.domain.auth.exception.AuthException
import com.threedays.oas.model.ErrorResponse
import com.threedays.support.common.base.exception.CustomException
import com.threedays.support.common.exception.NotFoundException
Expand All @@ -23,6 +24,15 @@ class ControllerAdvice {

}

@ExceptionHandler(AuthException.RefreshTokenExpiredException::class)
fun handleRefreshTokenExpiredException(e: AuthException.RefreshTokenExpiredException): ResponseEntity<ErrorResponse> {
logger.error(e) { "RefreshTokenExpiredException" }

val response: ErrorResponse = createErrorResponse(e.type, e.code)

return createResponseEntity(HttpStatus.UNAUTHORIZED, response)
}

@ExceptionHandler(CustomException::class)
fun handleCustomException(e: CustomException): ResponseEntity<ErrorResponse> {
logger.error(e) { "CustomException" }
Expand Down

0 comments on commit 2ffc510

Please sign in to comment.