diff --git a/src/commands/integration/smstest.ts b/src/commands/integration/smstest.ts index e9f4559..48f6584 100644 --- a/src/commands/integration/smstest.ts +++ b/src/commands/integration/smstest.ts @@ -11,6 +11,7 @@ import { Command } from 'commander' import { JnpfClient } from '../../core/client.ts' import { installAiHelpHook } from '../../core/help.ts' import { log } from '../../core/log.ts' +import { enhanceFromBackend, formatErrorLine } from '../_error_codes.ts' interface SmsTestOpts { configId: string @@ -31,7 +32,8 @@ export function buildIntegrationSmsTestCommand(): Command { // 1. 拉取 config 详情 const configR = await c.get>(`/message/AccountConfig/${opts.configId}`) if (configR.code !== 200 || !configR.data) { - log.error(`integration smstest 配置拉取失败: ${configR.msg || 'id 不存在'}`) + const enhanced = enhanceFromBackend(configR.msg || 'id 不存在', 'configId', { entity: 'integration' }) + log.error(` ${formatErrorLine(enhanced, { step: 0, stepName: '配置拉取' })}`) process.exit(1) } const config = configR.data @@ -49,7 +51,8 @@ export function buildIntegrationSmsTestCommand(): Command { // 3. 走 AccountConfig/testSendSms const r = await c.postJson('/message/AccountConfig/testSendSms', body) if (r.code !== 200) { - log.error(`integration smstest 失败: ${r.msg}`) + const enhanced = enhanceFromBackend(r.msg || '', 'sms', { entity: 'integration' }) + log.error(` ${formatErrorLine(enhanced, { step: 1, stepName: '后端API' })}`) process.exit(1) } log.info(`✓ 短信测试发送 OK (configId=${opts.configId}, to=${opts.phone})`)