Throw

The Throw Action immediately throws an error and halts evaluation of the Action Chain.

If you have App Notifiers configured, you will be notified of errors thrown by the Throw Action in the same way you would any other error.

Use Cases

  • To throw a descriptive error and cease evaluation when a Data Flow returns unexpected or incompatible information – perhaps if an HTTP Request Data Operation returns an error message of its own.
  • To throw a descriptive error and cease evaluation when users provide incompatible information.

Properties

Error Name

Expects type text.

This property directly defines the metadata.identifier property of the thrown error. When named descriptively, this property makes it easier to determine the root cause of the error while investigating or debugging.

Error Cause

Expects type text.

This property directly defines the metadata.identifier property of the thrown error. When named descriptively, this property makes it easier to determine the root cause of the error while investigating or debugging.

Example

In this example, the Throw Action is used in tandem with the Condition Action to thrown an error if the value given for session.number_input is invalid:

Should this Action Chain be fired while session.number_input is equal to 0, one of the invalid values, the application will throw the following error. Note how the values of metadata.identifier and metadata.message correspond to the Error name and Error cause properties defined by the Action:

 "error":{
   "airkitErrorType":"ApplicationError",
   "sourceProject":"cxr-undefined",
   "name":"ApplicationError",
   "identifier":"error.application.user-defined-error",
   "metadata":{
     "identifier":"Invalid number",
     "message":"Dividing by zero not allowed. Variable session.number_input cannot be equal to 1.",
     "metadata":{}
    }