mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-20 02:08:15 +08:00
update 优化分布式锁Lock4j异常拦截
This commit is contained in:
parent
1abd2e7d7e
commit
dd96cc38ae
@ -5,6 +5,7 @@ import cn.dev33.satoken.exception.NotPermissionException;
|
||||
import cn.dev33.satoken.exception.NotRoleException;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.http.HttpStatus;
|
||||
import com.baomidou.lock.exception.LockFailureException;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.validation.ConstraintViolation;
|
||||
import jakarta.validation.ConstraintViolationException;
|
||||
@ -131,6 +132,16 @@ public class GlobalExceptionHandler {
|
||||
return R.fail(e.getMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
* 分布式锁Lock4j异常
|
||||
*/
|
||||
@ExceptionHandler(LockFailureException.class)
|
||||
public R<Void> handleBaseException(LockFailureException e, HttpServletRequest request) {
|
||||
String requestURI = request.getRequestURI();
|
||||
log.error("获取锁失败了'{}',发生Lock4j异常." + requestURI, e.getMessage());
|
||||
return R.fail(HttpStatus.HTTP_UNAVAILABLE, "业务处理中,请稍后再试...");
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义验证异常
|
||||
*/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user