feat(bigscreen-update): v0.11e+ Phase C2 错误反馈统一化
bigscreen/update.ts: catch 后端错误时调 enhanceFromBackend (v0.11e+ A1 复用) 输出格式统一: '[step 1 后端API] field: CODE - message (suggestion)' 继续 Phase C2 统一化其他 create/update 文件
This commit is contained in:
1 parent
ced3a81971
commit
09d75b66d0
1 file changed
+3
-1
@@ -10,6 +10,7 @@ import { JnpfClient } from '../../core/client.ts'
|
||||
import { installAiHelpHook } from '../../core/help.ts'
|
||||
import { log, printJson } from '../../core/log.ts'
|
||||
import { initWebapi, loadVisualData } from '../../webapi/visualdata.ts'
|
||||
import { enhanceFromBackend, formatErrorLine } from '../_error_codes.ts'
|
||||
|
||||
interface Opts {
|
||||
id: string
|
||||
@@ -49,7 +50,8 @@ export function buildBigscreenUpdateCommand(): Command {
|
||||
loadVisualData.updateVisualData?.(opts.id, body) || loadVisualData.update?.(opts.id, body)
|
||||
)) as { code?: number; msg?: string; data?: unknown }
|
||||
if (r.code !== 200 && r.code !== undefined) {
|
||||
log.error(`bigscreen update 失败 (code=${r.code}): ${r.msg}`)
|
||||
const enhanced = enhanceFromBackend(r.msg || '', 'bigscreen', { entity: 'bigscreen' })
|
||||
log.error(` ${formatErrorLine(enhanced, { step: 1, stepName: '后端API' })}`)
|
||||
if (opts.json) printJson(r)
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user