Create an SfError.
The error message.
The error name. Defaults to 'SfError'.
Optionalactions: string[]
The action message(s).
OptionalexitCodeOrCause: number | Error
The exit code which will be used by SfdxCommand or he underlying error that caused this error to be raised.
Optionalcause: unknown
The underlying error that caused this error to be raised.
OptionalactionsAction messages. Hints to the users regarding what can be done to fix related issues.
OptionalcontextThe related context for this error.
OptionaldataSfdxCommand can return this process exit code.
ReadonlynameSets the context of the error. For convenience this object is returned.
The command name.
Convert an SfError state to an object. Returns a plain object representing the state of this error.
Staticcreatelike the constructor, but takes an typed object and let you also set context and data properties
Staticwrap
A generalized sfdx error which also contains an action. The action is used in the CLI to help guide users past the error.
To throw an error in a synchronous function you must either pass the error message and actions directly to the constructor, e.g.