Error Handling in Zoho Circuit: Timeout, Authorization, Execution, and Custom Errors | Zoho Circuit - Online Help

Error Handling

A state can run into errors for various reasons. In Zoho Circuit, most of the state definition errors are intimated before saving the circuit. Only functional states, such as function, webhook, and circuit, are bound to have runtime errors, the error handling feature is only supported for functional states. Runtime errors are classified into the following four scenarios:
  1. On Timeout
  2. On Authorization Failure
  3. On Execution Failure
  4. Custom Error
All four error handling options have two common fields, Retry and Fallback. You can define the error handling fields for a state under Configuration

 

On Timeout

When a functional state runs longer than the expected time, timeout errors occur. For handling timeout errors in code view, the field value "errorType": "Error.TimeOut"  will be added.

On Authorization Failure

If a state fails because of insufficient privileges to access the specified code, the error is handled as an authorization failure. In code view, name value "errorType": "Error.AuthorizationFailure" is added.

On Execution Failure

When a state's execution fails due to some exception which cannot be processed, it can be handled using execution failure. In code view, name value "errorType": "Error.ExecutionFailure" is appended.

Custom Error

You can customize your error handling using the error code or error message provided by the state output. For this, you need to configure Exception Type and Exception Value.
  1. Exception Type - Provide 'Error Code' or 'Error Message' from the drop down using which the error handling must take place.
  2. Exception Value - Enter the exact value of error code or error message that will be received in the state output.



By default, Custom Error name is set to Error 1, Error 2 or Error 3 based on the number of custom errors configured. To change the default name, click the 'edit' icon and specify a name.

 For custom errors in code view, name value "errorType": "Error.Custom" is appended.
 
All the above error handling options configures two fields: Retry and Fallback

Retry

You can retry the failed state for a specific number of attempts within predefined intervals using this option.
Retry consists of three fields:
  1. Delay - Set the time, number of seconds after which the state must be retried after failure.
  2. Attempt - Set the number of times the state has to be retried
  3. Step Delay - Increase the delay time for each attempt by multiplying the Delay time with the Step Delay number set.
                        New Delay Time = Delay * Step Delay
 For example, suppose the Delay is set to 5 seconds, Attempt is set to 3 and Step Delay is set to 2 for a 'Retry'. Then the first retry attempt takes place after 10 (5*2) seconds, the second attempt takes 20 (10*2) seconds and the third attempt takes 40 (20*2) seconds to get executed.
 
                        New Delay Time = Delay * Step Delay
      1st attempt        >            10s = 5s * 2
      2nd attempt      >           20s = 10s * 2
      3rd attempt       >           40s = 20s * 2



Fallback

In case of failure or error, the failed state can fall back to another state to continue the execution.
For setting up fallback, configure the following two fields:
  1. Next - Set the state name to which the inputs of the failed state and error output have to be passed'.
  2. Result - Set the field name in which the error received for the failed state has to be sent to the fallback state.


 
A sample state that handles an 'On Timeout' and 'Custom Error' in code view is displayed below.
  1. "SayHello": {
  2.       "type": "function",
  3.       "next": "branch",
  4.       "parameter": {
  5.             "name": "James"
  6.       },
  7.       "functionName": "HelloWorld_name",
  8.       "onError": [
  9.             {            
  10.                   "errorType": "Error.TimeOut",
  11.                   "retry": {
  12.                         "delay": 3,
  13.                         "attempt": 2,
  14.                         "stepDelay": 1
  15.                   },
  16.                   "fallback": {
  17.                         "result": "$.erroroutput",
  18.                         "next": "HelloWorld"
  19.                   }
  20.             },
  21.             {
  22.                   "errorType": "Error.Custom",
  23.                   "errorName": "Error 1",
  24.                   "errorCode": "101",
  25.                   "retry": {
  26.                   "delay": 3,
  27.                   "attempt": 3,
  28.                   "stepDelay": 1
  29.             },
  30.             "fallback": {
  31.                   "result": "$.error",
  32.                   "next": "Hello"
  33.             }
  34.       }
  35. ]

    • Related Articles

    • Webhooks

      Webhook enables communication between third-party applications and Zoho Circuit. With webhooks, you can make API calls and notify the applications whenever an action takes place in Zoho Circuit. Set up webhooks in the following three steps: Create a ...
    • Functions

      Function is a program script that performs a set of operations whenever invoked within an application. Set up functions in Zoho Circuit to actualize your business routines. Circuit's functions are serverless, where the cloud provider dynamically ...
    • Circuits

      The main purpose of Zoho Circuit is to build efficient circuits in the form of workflows to coordinate multiple microservices. Circuits are state machines that can trigger and track each step automatically, and retry when there are errors. Setting up ...
    • States in Zoho Circuit

      In Zoho Circuit, states are building blocks of a circuit that can perform tasks, make decisions, or simply pass the output from one state to another. You can build circuits with states using the drag and drop functionality in Builder View, or with ...
    • Introduction to Zoho Circuit

      What is Zoho Circuit? Zoho circuit is a platform for integrating microservices to create automated workflows. With sophisticated flow controls, you can create custom applications or processes as workflows, without writing any code. Workflows created ...

    You are currently viewing the help articles of Qntrl 3.0. If you are still using our older version and require guidance with it, Click here.