After reading this article you will know:

  • How to get the error information
  • How to setup basic error handling

Before we start, if you don’t know what an HTTP request is, you can find more about them in the Action Event Reference. If you do know what they are, this article will tell you how to work with an HTTP request’s error logging!

Error info as

When creating an HTTP request you'll notice that you can set the Error info as variable. This variable collects error information about the request, which can then be used for the remainder of the action.

The variable is treated as an Object, where 2 attributes can be accessed, containing the information. The 2 attributes are:

  • success: Was the request successful? Returns true or false.
  • message: The (error) message the webservice returned.

The data is stored in JSON:

{"success":false,"message":"Failed to reach web service within 20 seconds"}

In case the request is successful, this variable will be blank, as no error turned up.
For the remainder of this article, we'll refer to this variable as var:error_info.

Getting the error information

As explained above, the information is stored as JSON data in the variable. To access the attributes and their values, you'll need 2 additional variables.

Success

To access the value in the success attribute, create a Checkbox expression variable.
Call the variable success, and enter the following expression.

var:error_info[success]

You can use this variable in Conditions or other events to check if the request was successful.

Message

To access the value in the message attribute, create a Text expression variable.
Call the variable message, and enter the following expression.

var:error_info[message]

You can use this variable in Conditions events to check what kind of error you received and in Create/Update events to save the error in a Text property!

Setting up error handling

When the request has failed, the success variable we just created will return false. You can use this in a condition to setup a different action for when an error occurs. In the example below, we send an email to a developer about whether or not the request completed succesfully.

Did this answer your question?