fix(文案出口): 用户可见提示语一律走 UserMessages 把关,并补结果作业租约围栏
两件事同源:2026-10-09 任务 30456 的卡片上同时出现中文进度和一句英文异常原文。 围栏:派发链在执行前重读 job 行,让 activateRunningClaim 的 CAS 恒真,撞锁方 deferRunning 把在跑的行翻回 PENDING,markSuccess 静默写 0 行——成功被判成失败。 claim 快照现在贯穿到 runClaimed 不再回读,markSuccess 返回布尔并补 stage=SUCCESS_LOST 日志,让这次丢失可观测。 文案:普查数出 61 处把 ex.getMessage() 拼进用户可见字段(异常响应、任务 error_message、 结果作业 error_msg、看板 message),逐条翻译追不上新增速度,改为出口把关—— UserMessages.with(中文主干, 异常) 只拼接中文详情、orFallback(原文, 兜底句) 只放行含中文的串, 被换掉的原文进日志;GlobalExceptionHandler 按码分档兜底(401/4011/40902 各说各的话)。 另把 chunk-read-failed[N] 摘要写成"第 N 分片读取失败"、TASK_LOCK_BUSY 换成中文(40902 码不动, 客户端按码分支)。数字人两处与结果作业 worker 故意仍存原文:孤儿判定与三条 preserves raw 用例按 error_message 读它,界面侧由前端 userNotice 兜住,已在新尺子里点名豁免并反查豁免是否还被用到。 尺子:RawExceptionMessageSinkGuardTest(出口行数下限硬钉 1500+内存造违例自证)、UserMessagesTest、 UserFacingMessageChineseGuardTest 豁免表收到只剩 JSON 键 msg 一条。mvn -o test 4205 例 0 失败。
This commit is contained in:
+3
-2
@@ -1,5 +1,6 @@
|
||||
package com.nanri.aiimage.modules.digitalhuman.service;
|
||||
|
||||
import com.nanri.aiimage.common.util.UserMessages;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.nanri.aiimage.common.exception.BusinessException;
|
||||
@@ -96,7 +97,7 @@ public class DigitalHumanVersionService {
|
||||
return toVo(entity);
|
||||
} catch (IOException e) {
|
||||
log.error("上传数字人版本失败", e);
|
||||
throw new BusinessException("文件处理失败:" + e.getMessage());
|
||||
throw new BusinessException(UserMessages.with("文件处理失败", e));
|
||||
} catch (RuntimeException e) {
|
||||
log.error("[digital-human-version] upload failed version={} filename={} elapsedMs={} err={}",
|
||||
version, originalFilename, elapsedMs(startedAt), e.getMessage(), e);
|
||||
@@ -277,7 +278,7 @@ public class DigitalHumanVersionService {
|
||||
BigInteger bigInt = new BigInteger(1, digest);
|
||||
return bigInt.toString(16).toLowerCase();
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException("计算 MD5 失败:" + e.getMessage());
|
||||
throw new BusinessException(UserMessages.with("计算 MD5 失败", e));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user