feat(portal-release): v0.11e+ enhanceFromBackend (Phase C2)
portal/release.ts: - import enhanceFromBackend + formatErrorLine - catch 后端错时 enhanceFromBackend
This commit is contained in:
1 parent
b245ffd69f
commit
7f212f6378
1 file changed
+3
-1
@@ -13,6 +13,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 ReleaseOpts {
|
||||
id: string
|
||||
@@ -39,7 +40,8 @@ export function buildPortalReleaseCommand(): Command {
|
||||
}
|
||||
const r = await c.putJson(`/visualdev/Portal/Actions/release/${opts.id}`, body)
|
||||
if (r.code !== 200) {
|
||||
log.error(`portal release 失败 (code=${r.code}): ${r.msg}`)
|
||||
const enhanced = enhanceFromBackend(r.msg || '', 'portal', { entity: 'portal' })
|
||||
log.error(` ${formatErrorLine(enhanced, { step: 0, stepName: '后端API' })}`)
|
||||
process.exit(1)
|
||||
}
|
||||
log.info(`✓ 门户 id=${opts.id} 已发布 (pc=${pc} app=${app})`)
|
||||
|
||||
Reference in new issue
Block a user