ParseError
Error thrown when argv tokenization / parsing fails.
Exit code defaults to 2 (standard for CLI usage errors).
- Import:
@kjanat/dreamcli - Export kind: class
- Declared in:
src/core/errors/index.ts - Source link:
src/core/errors/index.ts:145
Signatures
ts
class ParseError extends CLIError {}Members
Constructors
constructor
Create a parse error with exit code defaulting to 2.
ts
constructor(message: string, options: ParseErrorOptions);Properties
name
Always 'ParseError'. @override
ts
name: "ParseError";code
Narrowed to parse-category codes.
ts
code: ParseErrorCode;exitCode
Process exit code (defaults to 1).
ts
exitCode: number;suggest
One-liner actionable hint.
ts
suggest: string | undefined;details
Structured payload for machine output.
ts
details: Readonly<Record<string, unknown>> | undefined;message
ts
message: string;stack
ts
stack?: string | undefined;cause
ts
cause?: unknown;isError
Indicates whether the argument provided is a built-in Error instance or not.
ts
isError: (error: unknown) => error is Error;Methods
toJSON
Serialise to a plain object suitable for JSON output.
details is projected onto JSON-representable values: bigints become decimal digits and entries JSON cannot carry are omitted. The error object itself keeps the runtime values.
ts
toJSON(): CLIErrorJSON;