Welcome to Portal

?Unknown\pull-down

Welcome to Zoho Cares

Bienvenido a Soporte de Zoho

Search our knowledge base, ask the community or submit a request.

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, enabling a fallback to the next state in case of an error during execution. This feature is not available for Flow Controls but is specifically designed for Functional states and Bridge Controls.

Error selector

Error Selector is used to define how the system should respond when an error occurs during state execution. It lets you configure specific actions or data to be used in response to an error. You define key-value pairs, similar to Result Selector, where each key represents an action or error data. These values can be either static or derived from the error details.

For instance, in an employee onboarding system, you might configure Error Selector to extract error codes and messages dynamically from error details during execution.

 

Here's how you can configure an Error Selector in Code view.

To Define static error values:
"error_selector": {
      "error_code": "EXC_TME_EXC",
      "error_message": "Execution Time Exceeded"
}

To dynamically retrieve error details from the execution during error scenarios:

"error_selector": {
      "error_code": "$.error_code",
      "error_message": "$.error_description"
}
In this example, when an error occurs, the system will extract the "error_code" and "error_description" from the error details and make them available for further processing or response.

Error Path

Error Path specifies the location where the error details should be directed for further analysis or handling. If the Error Path isn't specified, the processed input from the previous state is automatically sent to a designated fallback state when an error occurs.


In your employee onboarding system, you may need to direct error details to a designated path, like '$.error'. Here's how you can set up the Error Path in the Code view:
{
      "onboard_employee": {
            "type": "function",
            "next": "End",
            "start": true,
            "function_id": "function_emp_onboard_1",
            "on_error": [
            {
                  "error_type": "timeout_error",
                  "fallback": {
                        "next": "End",
                        "error_selector": {
                              "error_code": "EXC_TME_EXC",
                              "error_description": "Execution Time Limit Exceeded"
                        },
                        "error_path": "$.error"
                  }
            }
            ]
      }
}

In this case, the error details are sent to the '$.error' path for further evaluation and appropriate action.

 

The example JSON below illustrates sample error details generated by the system during an error occurrence, providing information about the error's nature and context for further actions. 
{
      "status": "error",
      "message": "Employee onboarding failed",
      "error_code": "EXC_TME_EXC",
      "error_description": "Execution Time Exceeded"
}


Helpful?00
Updated: 8 months ago
Share :
Follow

Subscribe to receive notifications from this article.