Skip to content

ActionError ​

Error class for an exception thrown during action execution. Stored in Action.error.

TIP

This is the exception you should handle and show to the user in the UI.

Constructor ​

new ActionError(actionName: string, options: { cause: Error }) ​

Parameters: actionName — name of the action; options.cause — original error.

Properties: name: 'ActionError', message from cause.

Instance properties ​

cause: Error (read-only) ​

The original error that caused this ActionError.

Instance methods ​

throwCause(): void ​

Rethrows the original cause.

toString(): string ​

Returns the cause's message.

Example ​

typescript
await model.fetchUser.exec()
if (model.fetchUser.error) {
  console.error('Action failed:', model.fetchUser.error.cause)
  model.fetchUser.error.throwCause()
}

See also: Action, Internal errors.

Released under the MIT License.