fix(auth): 记录未登录异常的详细日志

- 在处理未登录异常的方法中添加错误日志记录
- 记录异常类型以方便问题定位
- 记录异常信息帮助诊断具体原因
- 保持返回 401 状态码和提示信息不变
This commit is contained in:
曹鹏飞 2026-05-12 15:07:06 +08:00
parent cd9692efae
commit 4daa6983be
1 changed files with 2 additions and 0 deletions

View File

@ -68,6 +68,8 @@ public class GlobalRestControllerAdvice {
@ExceptionHandler(NotLoginException.class)
@ResponseStatus(HttpStatus.UNAUTHORIZED) // 返回 401 状态码
public String handleNotLoginException(NotLoginException e) {
log.error("未登录异常类型: {}", e.getType());
log.error("未登录异常信息: {}", e.getMessage());
return "请重新登录";
}