optimize: 优化异常提示信息
This commit is contained in:
parent
1d59e425e9
commit
1a9b7154cc
|
|
@ -1,5 +1,6 @@
|
||||||
package com.nflg.product.base.core.exception;
|
package com.nflg.product.base.core.exception;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import nflg.product.common.constant.STATE;
|
import nflg.product.common.constant.STATE;
|
||||||
import nflg.product.common.vo.ResultVO;
|
import nflg.product.common.vo.ResultVO;
|
||||||
|
|
@ -51,7 +52,7 @@ public class BaseGlobalExceptionHandle {
|
||||||
public ResultVO<String> handleDuplicateKeyException(DuplicateKeyException e) {
|
public ResultVO<String> handleDuplicateKeyException(DuplicateKeyException e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
//return ResultVO.error("已存在该记录,请勿重复操作");
|
//return ResultVO.error("已存在该记录,请勿重复操作");
|
||||||
return ResultVO.error("已存在该记录,请勿重复操作");
|
return ResultVO.error("数据库存在重复数据");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -59,8 +60,11 @@ public class BaseGlobalExceptionHandle {
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ResultVO<String> handleException(Exception e) {
|
public ResultVO<String> handleException(Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
//return ResultVO.error("操作失败,请联系系统管理员");
|
if (StrUtil.isNotBlank(e.getMessage()) && e.getMessage().contains("Deadlock")) {
|
||||||
return ResultVO.error("操作失败,请联系系统管理员");
|
return ResultVO.error("操作失败,请重试");
|
||||||
|
} else {
|
||||||
|
return ResultVO.error("操作失败,请联系系统管理员");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue