@@ -56,6 +56,7 @@ import {
5656} from "@metaobjectsdev/migrate-ts" ;
5757import type { AgentSchemaInput , SchemaColumnLike } from "@metaobjectsdev/codegen-ts" ;
5858import { reportLoadError } from "../lib/load-error.js" ;
59+ import { describeError } from "../lib/error-text.js" ;
5960
6061/**
6162 * Print a load failure with everything the loader's ADR-0009 envelope carried — the stable
@@ -319,7 +320,7 @@ function buildAgentSchemaInput(
319320 // agent pages still emit.
320321 log . warn (
321322 `docs: agent/schema.md skipped — the expected schema could not be built ` +
322- `(${ ( err as Error ) . message } ). Run 'meta migrate' for the full diagnosis.` ,
323+ `(${ describeError ( err ) } ). Run 'meta migrate' for the full diagnosis.` ,
323324 ) ;
324325 return undefined ;
325326 }
@@ -337,7 +338,7 @@ export async function docsCommand(
337338 try {
338339 flags = parseDocsArgs ( args , cwd ) ;
339340 } catch ( err ) {
340- log . error ( `docs: ${ ( err as Error ) . message } ` ) ;
341+ log . error ( `docs: ${ describeError ( err ) } ` ) ;
341342 return 2 ;
342343 }
343344
@@ -424,7 +425,7 @@ export async function docsCommand(
424425 flags . projectRootProvided ? { explicitDir : metaRoot } : undefined ,
425426 ) ;
426427 } catch ( err ) {
427- log . error ( `docs: ${ ( err as Error ) . message } ` ) ;
428+ log . error ( `docs: ${ describeError ( err ) } ` ) ;
428429 return 2 ;
429430 }
430431
@@ -474,7 +475,7 @@ export async function docsCommand(
474475 configLoadOptions = loadMemoryOptionsFrom ( loadedConfig ) ;
475476 } catch ( err ) {
476477 log . warn (
477- `docs: metaobjects.config.ts failed to load (${ ( err as Error ) . message } ); ` +
478+ `docs: metaobjects.config.ts failed to load (${ describeError ( err ) } ); ` +
478479 `generating docs without its providers` ,
479480 ) ;
480481 loadedConfig = undefined ;
@@ -564,7 +565,7 @@ export async function docsCommand(
564565 suite = resolveGenerators ( loadedConfig ?. generators ?? [ ] ) ;
565566 } catch ( err ) {
566567 log . warn (
567- `docs: could not resolve the generator suite (${ ( err as Error ) . message } ) — the agent ` +
568+ `docs: could not resolve the generator suite (${ describeError ( err ) } ) — the agent ` +
568569 `pages fall back to the generators declared as values, so a tier wired by name may ` +
569570 `be missing from them.` ,
570571 ) ;
@@ -624,7 +625,7 @@ export async function docsCommand(
624625 try {
625626 modelFiles = await docsFile ( modelOpts ) . generate ( ctx ) ;
626627 } catch ( err ) {
627- const msg = ( err as Error ) . message ;
628+ const msg = describeError ( err ) ;
628629 // Duplicate output path (silent-overwrite backstop): the generator already
629630 // names both colliding FQNs + the path and starts with "docs:". Surface it
630631 // verbatim as a clean non-zero exit (no double prefix, no stack trace).
@@ -680,7 +681,7 @@ export async function docsCommand(
680681 ) ;
681682 }
682683 } catch ( err ) {
683- const msg = ( err as Error ) . message ;
684+ const msg = describeError ( err ) ;
684685 if ( msg . startsWith ( "docs: duplicate output path" ) ) {
685686 log . error ( msg ) ;
686687 return 1 ;
@@ -743,7 +744,7 @@ export async function docsCommand(
743744 await writeFile ( path , f . content , "utf8" ) ;
744745 }
745746 } catch ( err ) {
746- log . error ( `docs: failed to write pages: ${ ( err as Error ) . message } ` ) ;
747+ log . error ( `docs: failed to write pages: ${ describeError ( err ) } ` ) ;
747748 return 1 ;
748749 }
749750
@@ -812,7 +813,7 @@ async function scaffoldSiteCommand(projectRoot: string): Promise<number> {
812813 created . push ( rel ) ;
813814 }
814815 } catch ( err ) {
815- log . error ( `docs: failed to scaffold site templates: ${ ( err as Error ) . message } ` ) ;
816+ log . error ( `docs: failed to scaffold site templates: ${ describeError ( err ) } ` ) ;
816817 return 1 ;
817818 }
818819 log . info (
@@ -919,7 +920,7 @@ async function emitSite(
919920 log . info ( `meta docs --site — wrote ${ r . pages . length } page(s) → ${ siteOutDir } ` ) ;
920921 return 0 ;
921922 } catch ( err ) {
922- log . error ( `docs: failed to generate site: ${ ( err as Error ) . message } ` ) ;
923+ log . error ( `docs: failed to generate site: ${ describeError ( err ) } ` ) ;
923924 return 1 ;
924925 }
925926}
@@ -937,7 +938,7 @@ async function metamodelDocsCommand(cwd: string, out: string): Promise<number> {
937938 try {
938939 docs = renderCoreMetamodelDocs ( composeRegistry ( coreProviders ) ) ;
939940 } catch ( err ) {
940- log . error ( `docs: failed to render metamodel docs: ${ ( err as Error ) . message } ` ) ;
941+ log . error ( `docs: failed to render metamodel docs: ${ describeError ( err ) } ` ) ;
941942 return 1 ;
942943 }
943944 try {
@@ -948,7 +949,7 @@ async function metamodelDocsCommand(cwd: string, out: string): Promise<number> {
948949 await writeFile ( path , content , "utf8" ) ;
949950 }
950951 } catch ( err ) {
951- log . error ( `docs: failed to write metamodel pages: ${ ( err as Error ) . message } ` ) ;
952+ log . error ( `docs: failed to write metamodel pages: ${ describeError ( err ) } ` ) ;
952953 return 1 ;
953954 }
954955 log . info ( `meta docs --metamodel — wrote ${ docs . size } page(s) → ${ outDir } ` ) ;
0 commit comments