Error Handling | Online Help | Qntrl | Circuit

Error Handling

In Qntrl Circuit, you can configure error handling while building a circuit. State definition errors are detected even before saving the circuit. When you save the circuit, a compilation check runs and lists out errors related to its state configurations, logic flow, and design. This helps you verify and fix errors in your circuit design and configuration even before execution.


Only Functional states, such as Function, Webhook, and Circuit, are subject to runtime errors, so the error handling is supported only for Functional states. When you add a functional state, the Error Handling option appears under Configuration in the right panel.


Runtime Error Scenarios

Runtime errors are categorized into four scenarios, each with Retry and Fallback error handling options.
  • On Timeout

  • On Authorization Failure

  • On Execution Failure

  • Custom Error



On Timeout

When a functional state runs longer than the expected time, a timeout error occurs. This option is available for Function and Webhook. 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. This option is only available for Webhook states. In the code view, the name value "errorType": "Error.AuthorizationFailure" is added.

On Execution Failure

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


Custom Error

Handle exceptions in your function through an Error Code or an Error Message besides Retry and Fallback options. Refer Custom Error section to configure custom error.

Error Handling Options

When you select any error handling options, a pop-up appears with Retry and Fallback fields common for all error-handling options. 



Retry

You can retry the failed state for a specific number of attempts within predefined intervals.

Retry consists of three fields:

  • Delay: Set the time in seconds after which the state must be retried after failure.

  • Attempt: Set the number of retry attempts.

  • Step Delay: Increase the delay time for each attempt by multiplying the delay time with the Step Delay number set.

For example, if Delay is set to 5 seconds, Attempt to 3, and Step Delay to 2:                         
New Delay Time = Delay * Step Delay ^ (attempt - 1)
  1. 1st attempt --> 5s * (2^0) = 5s
  2. 2nd attempt --> 5s * (2^1) = 10s
  3. 3rd attempt --> 5s * (2^2) = 20s
The first retry attempt takes place after 5 seconds, the second attempt takes 10 seconds, and the third attempt takes 20 seconds to execute.



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:
  • Next: Set the state name to which the inputs of the failed state and error output have to be passed.
  • Result: Set the field name from which the error details can be retrieved.
  • Error Path: Maps error responses in case of failure, specifying the input for the next state.
  • Error Selector: Configures error responses that can be merged with the previous state input and transitioned to the Fallback state.
For more details on Error Selector and Error Path, please refer to this section.



Custom Error 

For custom error handling, you need to configure Exception Type and Exception Value.
  1. Click the +Add Custom Error option under Error Handling. A pop up appears.
  2. Under Exceptions, select Error Code/Error Message from the dropdown using which the error handling must take place.
  3. In the next field enter the path/value where the error code or error message will be received in the state output.



By default, the Custom Error name is set to Error 1Error 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, the name value "errorType": "Error.Custom" is appended. A sample state that handles an On Timeout and Custom Error in code view is displayed below.

{
"Function for stock status": {
"type": "function",
"next": "End",
"start": true,
"function_id": "updatestockstatus_71",
"on_error": [
{
"error_type": "timeout_error",
"retry": {
"delay": 3,
"attempt": 3,
"step_delay": 1
},
"fallback": {
"next": "End",
"error_path": "$.error3"
}
},
{
"error_type": "custom_error",
"error_name": "Error 1",
"error_code": "101",
"retry": {
"delay": 3,
"attempt": 3,
"step_delay": 1
 },
"fallback": {
"next": "End",
"error_path": "$.Error"
}
}
]
}
}




    • Related Articles

    • Error Selector and Error Path

      Error Selector and Error Path are used to manage errors in a system. While Result Selector and Result Path control the output of a state upon successful execution, Error Selector and Error Path come into play when the are exceptional circumstances, ...
    • Task Engine

      Circuit's Task Engine state is used to connect with other applications and access APIs from a closed space. To retrieve data from a private network, the required API must be accessed from the local machine's network for the required conditions. ...
    • Circuit

      Circuit enables you to create automated workflows for IT and business by organizing a sequence of tasks. In certain cases, a process might include complex sub-processes that can be constructed as separate standalone circuits. These circuits can be ...
    • Features of Circuit

      Configure with or without code Circuit provides a platform to build workflow orchestrations with or without code. You can either visually design the Circuit schematics by dragging and dropping its elements in Builder View, or build its JSON code in ...
    • DB Engine

      This state enables a connection with the database hosted on a private or local network and executes the defined SQL query in the database. Prerequisite An active Bridge agent. Refer here to install and configure Bridge. Create the necessary ...

    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.