整合jwt
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.nl.exception.handler;
|
||||
|
||||
import cn.dev33.satoken.exception.NotLoginException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.exception.EntityExistException;
|
||||
@@ -59,6 +60,19 @@ public class GlobalExceptionHandler {
|
||||
// return buildResponseEntity(ApiError.error(message));
|
||||
// }
|
||||
|
||||
/**
|
||||
* token 无效的异常拦截
|
||||
* @param e
|
||||
* @return
|
||||
*/
|
||||
@ExceptionHandler(value = NotLoginException.class)
|
||||
public ResponseEntity<ApiError> notLoginException(Exception e) {
|
||||
// e.printStackTrace();
|
||||
log.error(ThrowableUtil.getStackTrace(e));
|
||||
return buildResponseEntity(ApiError.error("Token 无效"));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 处理自定义异常
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user