diff --git a/src/commands/bigscreen/construct.ts b/src/commands/bigscreen/construct.ts index b02b364..a2d4f86 100644 --- a/src/commands/bigscreen/construct.ts +++ b/src/commands/bigscreen/construct.ts @@ -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=: 官方模板 (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() } diff --git a/src/commands/portal/create.ts b/src/commands/portal/create.ts index 3d4fc95..6febb15 100644 --- a/src/commands/portal/create.ts +++ b/src/commands/portal/create.ts @@ -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)}`,