From 49ad18b545824fa48bcb18cd3c2ce5d84e3cea2f Mon Sep 17 00:00:00 2001 From: FatttSnake Date: Fri, 8 Mar 2024 17:51:58 +0800 Subject: [PATCH] Fix: exception handler - fix wrong response code when catch DisabledException --- .../top/fatweb/oxygen/api/handler/ExceptionHandler.kt | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/main/kotlin/top/fatweb/oxygen/api/handler/ExceptionHandler.kt b/src/main/kotlin/top/fatweb/oxygen/api/handler/ExceptionHandler.kt index 9acf7f8..d9969c0 100644 --- a/src/main/kotlin/top/fatweb/oxygen/api/handler/ExceptionHandler.kt +++ b/src/main/kotlin/top/fatweb/oxygen/api/handler/ExceptionHandler.kt @@ -93,10 +93,10 @@ class ExceptionHandler { is DisabledException -> { logger.debug(e.localizedMessage, e) - ResponseResult.fail(ResponseCode.PERMISSION_USER_CREDENTIALS_EXPIRED, "User has been disabled", null) + ResponseResult.fail(ResponseCode.PERMISSION_USER_DISABLE, "User has been disabled", null) } - is TokenExpiredException -> { + is TokenExpiredException, is TokenHasExpiredException -> { logger.debug(e.localizedMessage, e) ResponseResult.fail(ResponseCode.PERMISSION_TOKEN_HAS_EXPIRED, e.localizedMessage, null) } @@ -120,11 +120,6 @@ class ExceptionHandler { ResponseResult.fail(ResponseCode.PERMISSION_TOKEN_ILLEGAL, "Token illegal", null) } - is TokenHasExpiredException -> { - logger.debug(e.localizedMessage, e) - ResponseResult.fail(ResponseCode.PERMISSION_TOKEN_HAS_EXPIRED, e.localizedMessage, null) - } - is AccessDeniedException -> { logger.debug(e.localizedMessage, e) ResponseResult.fail(ResponseCode.PERMISSION_ACCESS_DENIED, "Access Denied", null)