CLIError
Base structured error for DreamCLI.
Every error surfaced by the framework extends this class, ensuring a consistent shape for rendering (TTY pretty-print, --json, test assertions).
- Import:
@kjanat/dreamcli - Export kind: class
- Declared in:
src/core/errors/index.ts - Source link:
packages/dreamcli/src/core/errors/index.ts:61
Signatures
class CLIError extends Error {}Members
Constructors
constructor
constructor();Properties
cause
The cause of the error.
cause?: unknown;code
Stable machine-readable identifier.
code: ErrorCode;details
Structured payload for machine output.
details: Readonly<Record<string, unknown>> | undefined;exitCode
Process exit code (defaults to 1).
exitCode: number;message
message: string;name
Error class name, always 'CLIError' for the base class.
name: string;stack
stack?: string;suggest
One-liner actionable hint.
suggest: string | undefined;stackTraceLimit
The Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)).
The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed.
If set to a non-number value, or set to a negative number, stack traces will not capture any frames.
stackTraceLimit: number;Methods
toJSON
toJSON(): CLIErrorJSON;captureStackTrace
captureStackTrace(targetObject: object, constructorOpt?: Function): void;isError
isError(error: unknown): error is Error;prepareStackTrace
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;Related Examples
- Mixed machine-readable JSON and human-readable side-channel output. -
examples/standalone/json-mode.ts - Middleware patterns: auth guard, request timing, error handling. -
examples/standalone/middleware.ts