feat(app-create): v0.11e+ enhanceFromBackend (Phase C2)
app/create.ts: 加 enhanceFromBackend 替换 简单 log.error (EXIST105 应用编码重复)
This commit is contained in:
1 parent
e46b80d5f7
commit
e9d24757b7
1 file changed
+3
-1
@@ -24,6 +24,7 @@ import { installAiHelpHook } from '../../core/help.ts'
|
||||
import { log } from '../../core/log.ts'
|
||||
import { saveToken } from '../../core/config.ts'
|
||||
import type { TokenFile } from '../../core/types.ts'
|
||||
import { enhanceFromBackend, formatErrorLine } from '../_error_codes.ts'
|
||||
|
||||
interface CreateOpts {
|
||||
appCode: string
|
||||
@@ -91,7 +92,8 @@ export function buildAppCreateCommand(): Command {
|
||||
}
|
||||
const r = await c.postJson<string>('/system/System', body)
|
||||
if (r.code !== 200) {
|
||||
log.error(` ✗ 创建系统失败: code=${r.code} ${r.msg}`)
|
||||
const enhanced = enhanceFromBackend(r.msg || '', 'appSystem', { entity: 'app' })
|
||||
log.error(` ✗ ${formatErrorLine(enhanced, { step: 1, stepName: '创建系统' })}`)
|
||||
process.exit(1)
|
||||
}
|
||||
// 创建后再查一次拿 id
|
||||
|
||||
Reference in new issue
Block a user