8eac51cd45
CliError used to live in cli.ts and was imported by configFile.ts purely
to grab a one-line class — the dependency arrow said 'config-file loader
depends on the CLI parser' when really it just needed a shared error
type.
Moving CliError to its own errors.ts module flattens the graph:
errors.ts (no internal deps)
|
+-- cli.ts
+-- configFile.ts
+-- config.ts (will use it in the next commit)
cli.ts re-exports CliError for any consumer that prefers to keep
importing it from there; the canonical home is now errors.ts.
17 lines
667 B
TypeScript
17 lines
667 B
TypeScript
/**
|
|
* errors.ts
|
|
* ---------
|
|
* Cross-cutting error types used by parsers, loaders, and config resolution.
|
|
* Kept in its own module so feature modules can import error types without
|
|
* pulling in unrelated implementation code (e.g., the JSON loader doesn't
|
|
* need to depend on the CLI parser just to throw a typed error).
|
|
*/
|
|
|
|
/**
|
|
* Thrown when user-supplied input is invalid: unknown CLI option, missing
|
|
* value, non-positive number, malformed config file, unresolvable default
|
|
* path, etc. Distinct from runtime errors so the top-level entry can exit
|
|
* with code 2 (user error) instead of code 1 (runtime failure).
|
|
*/
|
|
export class CliError extends Error {}
|