diff --git a/src/main/kotlin/top/fatweb/api/handler/ExceptionHandler.kt b/src/main/kotlin/top/fatweb/api/handler/ExceptionHandler.kt index c4abedb..e4b41e0 100644 --- a/src/main/kotlin/top/fatweb/api/handler/ExceptionHandler.kt +++ b/src/main/kotlin/top/fatweb/api/handler/ExceptionHandler.kt @@ -2,6 +2,7 @@ package top.fatweb.api.handler import com.auth0.jwt.exceptions.JWTDecodeException import com.auth0.jwt.exceptions.SignatureVerificationException +import com.auth0.jwt.exceptions.TokenExpiredException import org.slf4j.Logger import org.slf4j.LoggerFactory import org.springframework.http.converter.HttpMessageNotReadableException @@ -32,6 +33,11 @@ class ExceptionHandler { ResponseResult.fail(ResponseCode.SYSTEM_REQUEST_ILLEGAL, e.localizedMessage.split(":")[0], null) } + is TokenExpiredException -> { + log.debug(e.localizedMessage, e) + ResponseResult.fail(ResponseCode.SYSTEM_TOKEN_HAS_EXPIRED, e.localizedMessage, null) + } + is MethodArgumentNotValidException -> { log.debug(e.localizedMessage, e) val errorMessage = e.allErrors.map { error -> error.defaultMessage }.joinToString(". ")