Files
dacli/docs
ssw 4a942c1d54 feat(errors): v0.11e+ Phase A1 错误码分类闭环 (镜像 MsgCode.java:50-783)
新建 src/commands/_error_codes.ts (335 行):
- ErrorCode union type (top 30 常用: EXIST001/002/101/102/103/104, FA001/002/003/019/021/028/029, VS024/401/402/403/408/409/411/412, SYS014/017, DB201/302, WF025/054, FM005/007, OTHER 兜底)
- ErrorCategory enum (duplicate/not_found/permission/invalid_state/db/workflow/visual_dev/unknown)
- ALL_ERROR_CODES 字典 (code → { code, category, rawMessage, suggestion })
- classify(msg) — regex 提取 EXIST/FA/VS/SYS/DB/WF/FM prefix
- format(code, ctx) — 替换 suggestion 占位符
- aggregate(errors) — 按 code + category 分桶
- formatErrorLine(err, { step, stepName }) — 输出 '[step N name] field: CODE - message'
- enhanceFromBackend(msg, field, ctx) — catch 后端错一键增强

集成 7 _validate.ts (form/menu/dm/workflow/dict/role/di):
- ValidationError 加 code?: string 字段
- 关键错误标 code: EXIST001/002/104, VS030/401/402/408, WF054 等

集成 7 create/update.ts:
- catch 后端 r.msg 时调 enhanceFromBackend() 自动填 code
- 输出格式: '[step N name] field: CODE - message (suggestion)'

SKILL.md 加 v0.11e+ Phase A1 段 (架构/权威源/web 镜像/集成/验证)

端到端 tdd10 验证 (admin/123456, appCode=tdd10):
- EXIST002: dict typeCreate enCode 重复 → [step 1 唯一性] enCode: EXIST002 - 字典编码已存在
- EXIST001: dict typeCreate fullName 重复 → [step 1 唯一性] fullName: EXIST001 - 字典名称已存在

selfcheck 8/8 pass (_error_codes.ts + 7 _validate.ts)

镜像 web Form.vue:419 validatePopoverRef 字段级 + 后端 MsgCode.java:50-783 错误码体系
2026-06-27 03:05:23 +08:00
..