Skip to content

ParseError

Error thrown when argv tokenization / parsing fails.

Exit code defaults to 2 (standard for CLI usage errors).

Signatures

ts
class ParseError extends CLIError {}

Members

Constructors

constructor

ts
constructor();

Properties

cause

The cause of the error.

ts
cause?: unknown;

code

Narrowed to parse-category codes.

ts
code: ParseErrorCode;

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

Always 'ParseError'.

ts
name: "ParseError";

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.