feat(dacli): P5 全量 — portal/create + bigscreen/construct throw → DacliError
剩 2 命令路径文件 (其他 9 个用 P5 sample script 已改):
- portal/create.ts:76,93 (2 throw) — businessType 字典为空 input 校验
- bigscreen/construct.ts:269 (1 throw) — validProps empty
剩 throw new Error 全在 SDK/test/helper (跳过):
- form/{_ai,_buildformdata,_browser_verify}.ts (SDK 边界)
- _ssw_retry.ts (网络重试 helper)
- apis/_cache.ts (缓存 helper)
- test/{run,render,generate}.ts (test 预期 throws)
- menu/_helpers.ts (utility)
验证: TS compile 56 baseline, 0 新错误; portal create --help 正常输出
This commit is contained in:
1 parent
b39024a7ae
commit
c6b7fe8729
2 files changed
+7
-3
No files matched your search
@@ -1,6 +1,8 @@
|
||||
/**
|
||||
* commands/bigscreen/construct.ts — 大屏构造 (v0.13+ §8.2.4 阶段 5)
|
||||
*
|
||||
* 修改 P5 全量 (2026-07-21): throw new Error → DacliError 提升 L2 catch 分类.
|
||||
*
|
||||
* 用途: 一键创建带组件的大屏. 支持:
|
||||
* - --template=base: 内置空大屏模板 (9 组件 demo)
|
||||
* - --from-template=<name>: 官方模板 (Phase 5+ 扩展, 暂等同 --template=base)
|
||||
@@ -33,6 +35,7 @@ import { installHelpHook } from '../../core/help.ts'
|
||||
import { log, printJson } from '../../core/log.ts'
|
||||
import { initWebapi, loadVisualData } from '../../webapi/visualdata.ts'
|
||||
import { setupOutputFilter, printCommandEnd } from '../_output_filter.ts' // v2.1+ (2026-07-21): 输出过滤 + CommandLog 落盘
|
||||
import { DacliError } from '../../core/types.ts' // P5 (2026-07-21): 提升 L2 catch 分类
|
||||
import { runCommandAutoFix, fetchExistingLists } from '../_auto_fix.ts' // v2.1+ (2026-07-21): 跨命令 auto-fix pipeline
|
||||
import {
|
||||
getBaseConfig,
|
||||
@@ -266,7 +269,7 @@ async function runConstruct(opts: ConstructOpts): Promise<{ id?: string; enCode:
|
||||
let validProps: string[]
|
||||
try {
|
||||
validProps = getValidProps()
|
||||
if (validProps.length === 0) throw new Error('empty')
|
||||
if (validProps.length === 0) throw new DacliError('empty')
|
||||
} catch {
|
||||
validProps = listComponentProps()
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import {
|
||||
import { initWebapi as initDictWebapi, loadDict } from '../../webapi/dict.ts'
|
||||
import { runCommandAutoFix, fetchExistingLists } from '../_auto_fix.ts' // v2.1+ (2026-07-21): 跨命令 auto-fix pipeline
|
||||
import { setupOutputFilter, printCommandEnd } from '../_output_filter.ts' // v2.1+ (2026-07-21): 输出过滤 + CommandLog 落盘
|
||||
import { DacliError } from '../../core/types.ts' // P5 (2026-07-21): 提升 L2 catch 分类
|
||||
|
||||
interface CreateOpts {
|
||||
fullName: string
|
||||
@@ -73,7 +74,7 @@ async function resolvePortalCategory(
|
||||
(it: any) => ({ id: it.id, enCode: it.enCode, fullName: it.fullName }),
|
||||
)
|
||||
if (items.length === 0) {
|
||||
throw new Error(
|
||||
throw new DacliError(
|
||||
'businessType 字典为空 (JNPF 平台至少应有 13 项业务分类). 检查 web 端表单设计器是否初始化.',
|
||||
)
|
||||
}
|
||||
@@ -90,7 +91,7 @@ async function resolvePortalCategory(
|
||||
String(it.fullName).includes(String(opts.category)),
|
||||
)
|
||||
if (byCode) return { id: byCode.id, name: byCode.fullName, matched: 'explicit' }
|
||||
throw new Error(
|
||||
throw new DacliError(
|
||||
`--category "${opts.category}" 在字典 businessType 里找不到. 合法项: ${items
|
||||
.map((i) => `${i.fullName}(${i.id})`)
|
||||
.join(', ').slice(0, 200)}`,
|
||||
|
||||
Reference in new issue
Block a user