整合jwt
This commit is contained in:
@@ -9,9 +9,11 @@
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<properties>
|
||||
<hutool.version>5.3.4</hutool.version>
|
||||
<hutool.version>5.7.14</hutool.version>
|
||||
</properties>
|
||||
|
||||
<!--hutool 5.3.4-->
|
||||
|
||||
<artifactId>nladmin-common</artifactId>
|
||||
<name>公共模块</name>
|
||||
|
||||
|
||||
@@ -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