diff --git a/src/commands/print/info.ts b/src/commands/print/info.ts index 66469bd..d7bf91c 100644 --- a/src/commands/print/info.ts +++ b/src/commands/print/info.ts @@ -7,6 +7,7 @@ import { Command } from 'commander' import { JnpfClient } from '../../core/client.ts' import { installAiHelpHook } from '../../core/help.ts' import { log, printJson } from '../../core/log.ts' +import { enhanceFromBackend, formatErrorLine } from '../_error_codes.ts' interface InfoOpts { id: string @@ -22,11 +23,13 @@ export function buildPrintInfoCommand(): Command { const c = await JnpfClient.fromToken() const r = await c.get>(`/system/printDev/${opts.id}`) if (r.code !== 200) { - log.error(`print info 失败 (code=${r.code}): ${r.msg}`) + const enhanced = enhanceFromBackend(r.msg || '', 'print', { entity: 'print' }) + log.error(` ${formatErrorLine(enhanced, { step: 0, stepName: '后端API' })}`) process.exit(1) } if (!r.data) { - log.error(`print id=${opts.id} 不存在`) + const enhanced = enhanceFromBackend('打印模板 id 不存在', 'id', { entity: 'print' }) + log.error(` ${formatErrorLine(enhanced, { step: 0, stepName: '后端API' })}`) process.exit(1) } if (opts.json) {