Type Alias: CommandErrorOptions
Options for CommandError. All of them are optional.
Signature
ts
export type CommandErrorOptions = { code?: string; exitCode?: number; cause?: unknown }Properties
| Name | Type | Description |
|---|---|---|
cause (optional) | unknown | The error that caused the failure. Its message is printed as is, on a Caused by: line after the message of the CommandError, and so is the message of its own cause. With --json, the messages are in data.causes of the JSON error. Do not pass an error whose message may contain a secret, such as a token in a URL: write the message of the CommandError yourself instead. |
code (optional) | string | The name of the failure, for programs to read, such as not_found. snake_case is recommended. It is not printed to the user. With --json, it is the reason of the JSON error, as it is. |
exitCode (optional) | number | The exit code of the process, an integer from 1 to 255. Defaults to 1, and any other value is replaced with 1, since the command has failed. |
