错误日志修改

This commit is contained in:
2026-08-20 10:16:16 +08:00
parent 276a21c12a
commit e281915fa4
2 changed files with 10 additions and 2 deletions
@@ -65,7 +65,11 @@ public class SyncLogAspect {
try {
result = pjp.proceed();
} catch (Throwable t) {
entity.setErrorMsg(truncate(t.getMessage(), MAX_ERROR_MSG));
String msg = t.getMessage();
if (msg == null || msg.trim().isEmpty()) {
msg = t.getClass().getName();
}
entity.setErrorMsg(truncate(msg, MAX_ERROR_MSG));
entity.setStatus(0);
syncLogService.saveAsync(entity);
throw t;
@@ -72,7 +72,11 @@ public class SysOperationLogAspect {
return result;
} catch (Throwable e) {
entity.setStatusCode(500);
entity.setErrorMsg(truncate(e.getMessage(), 2000));
String msg = e.getMessage();
if (msg == null || msg.trim().isEmpty()) {
msg = e.getClass().getName();
}
entity.setErrorMsg(truncate(msg, 2000));
throw e;
} finally {
entity.setCostTime(System.currentTimeMillis() - start);