Fix: exception handler - fix wrong response code when catch DisabledException

This commit is contained in:
2024-03-08 17:51:58 +08:00
parent 09f800c16b
commit 49ad18b545

View File

@@ -93,10 +93,10 @@ class ExceptionHandler {
is DisabledException -> { is DisabledException -> {
logger.debug(e.localizedMessage, e) 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) logger.debug(e.localizedMessage, e)
ResponseResult.fail(ResponseCode.PERMISSION_TOKEN_HAS_EXPIRED, e.localizedMessage, null) 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) 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 -> { is AccessDeniedException -> {
logger.debug(e.localizedMessage, e) logger.debug(e.localizedMessage, e)
ResponseResult.fail(ResponseCode.PERMISSION_ACCESS_DENIED, "Access Denied", null) ResponseResult.fail(ResponseCode.PERMISSION_ACCESS_DENIED, "Access Denied", null)