Skip to content

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).

Signatures ​

ts
class CLIError extends Error {}

Members ​

Constructors ​

constructor ​

ts
constructor();

Properties ​

cause ​

The cause of the error.

ts
cause?: unknown;

code ​

Stable machine-readable identifier.

ts
code: ErrorCode;

details ​

Structured payload for machine output.

ts
details: Readonly<Record<string, unknown>> | undefined;

exitCode ​

Process exit code (defaults to 1).

ts
exitCode: number;

message ​

ts
message: string;

name ​

Error class name, always 'CLIError' for the base class.

ts
name: string;

stack ​

ts
stack?: string;

suggest ​

One-liner actionable hint.

ts
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.

ts
stackTraceLimit: number;

Methods ​

toJSON ​

ts
toJSON(): CLIErrorJSON;

captureStackTrace ​

ts
captureStackTrace(targetObject: object, constructorOpt?: Function): void;

isError ​

ts
isError(error: unknown): error is Error;

prepareStackTrace ​

ts
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;

See Also ​

Released under the MIT License.