|
|
@@ -40,11 +40,16 @@ public class ApiErrorLogServiceImpl implements ApiErrorLogService {
|
|
|
ApiErrorLogDO apiErrorLog = BeanUtils.toBean(createDTO, ApiErrorLogDO.class)
|
|
|
.setProcessStatus(ApiErrorLogProcessStatusEnum.INIT.getStatus());
|
|
|
apiErrorLog.setRequestParams(StrUtils.maxLength(apiErrorLog.getRequestParams(), REQUEST_PARAMS_MAX_LENGTH));
|
|
|
- if (TenantContextHolder.getTenantId() != null) {
|
|
|
- apiErrorLogMapper.insert(apiErrorLog);
|
|
|
- } else {
|
|
|
- // 极端情况下,上下文中没有租户时,此时忽略租户上下文,避免插入失败!
|
|
|
- TenantUtils.executeIgnore(() -> apiErrorLogMapper.insert(apiErrorLog));
|
|
|
+ try {
|
|
|
+ if (TenantContextHolder.getTenantId() != null) {
|
|
|
+ apiErrorLogMapper.insert(apiErrorLog);
|
|
|
+ } else {
|
|
|
+ // 极端情况下,上下文中没有租户时,此时忽略租户上下文,避免插入失败!
|
|
|
+ TenantUtils.executeIgnore(() -> apiErrorLogMapper.insert(apiErrorLog));
|
|
|
+ }
|
|
|
+ } catch (Exception ex) {
|
|
|
+ // 兜底处理,目前只有 yudao-cloud 会发生:https://gitee.com/yudaocode/yudao-cloud-mini/issues/IC1O0A
|
|
|
+ log.error("[createApiErrorLog][记录时({}) 发生异常]", createDTO, ex);
|
|
|
}
|
|
|
}
|
|
|
|