error-check-node

The Error Check Node for n8n is designed to detect errors in previous workflow nodes and handle them according to specified strategies. It allows you to classify errors, log them with custom messages, and define whether to stop, skip, or retry the workflo

Package Information

Released: 12/8/2024
Downloads: 0 weekly / 5 monthly
Latest Version: 0.1.0
Author: tuananhit1612

Documentation

Error Check Node for n8n

The Error Check Node for n8n is designed to check for errors in the workflow and handle them accordingly. It provides flexibility in defining how errors should be handled, including options to stop the workflow, continue the workflow, or log errors for further inspection.

This node helps streamline error handling in your workflows, ensuring that errors are managed consistently and efficiently.

Features:

  • Error Detection: Automatically detects errors in the workflow.
  • Error Type Classification: Select the type of error (Connection, Data, Logic).
  • Custom Error Message: Provide a custom error message to be logged or displayed.
  • Error Handling Strategy: Choose between retrying, skipping, or stopping the workflow when an error is detected.
  • Logging: Log the error with customizable logging levels and specify the storage location for logs (file, database, or external service).
  • Notification: Optionally send notifications for error occurrences.

Installation

To install and configure this custom node, follow these steps:

  1. Clone or download the repository.
  2. Follow the official n8n custom node installation guide.
  3. Ensure your n8n instance is configured to support the necessary dependencies for logging and error handling.

Node Configuration

Available Parameters:

The Error Check Node provides the following configuration options:

  1. Error Message Target:

    • UI: Display the error in the user interface.
    • Dev: Send the error message to the developer's environment.
    • Backend: Send the error details to the backend for processing.

    Default: ui

  2. On Error:

    • Stop Workflow: Stops the workflow execution when an error is detected.
    • Continue Workflow: Continues the workflow even if an error is encountered.

    Default: stop

  3. Error Type:

    • Connection Error: Errors related to network or database connection.
    • Data Error: Issues with the data processing or format.
    • Logic Error: Problems in the business logic or workflow design.

    Default: data

  4. Custom Error Message:

    • Enter a custom message to describe the error, which will be logged or displayed.

    Default: "" (Empty)

  5. Log Level:

    • Info: Log general information about the workflow.
    • Warning: Log potential issues that need attention.
    • Error: Log errors that stop the workflow or need immediate attention.

    Default: error

  6. Storage Location:

    • Local File: Store logs in a local file.
    • Database: Store logs in a database.
    • External Service: Use an external service for logging (e.g., an API or cloud service).

    Default: file

  7. Error Handling Strategy:

    • Retry: Retry the workflow step if an error occurs.
    • Skip: Skip the workflow step and continue.
    • Stop Workflow: Stop the workflow completely when an error occurs.

    Default: stop

Example Workflow

Input Data:

{
  "errorMessageTarget": "dev",
  "onError": "stop",
  "errorType": "data",
  "customErrorMessage": "Custom error message to describe the issue.",
  "logLevel": "warning",
  "storageLocation": "file",
  "errorHandlingStrategy": "retry"
}
  • Node Configuration:
  • Error Message Target: dev
  • On Error: stop
  • Error Type: data
  • Custom Error Message: Custom error message to describe the issue.
  • Log Level: warning
  • Storage Location: file
  • Error Handling Strategy: retry

Output Data (Example):

If the workflow encounters an error, the output may look like this:

{
  "errorInfo": {
    "message": "Error detected in node: ErrorCheckNode",
    "errorType": "dev",
    "details": "Custom error message to describe the issue."
  },
  "log": {
    "level": "warning",
    "message": "Workflow encountered a data error",
    "storage": "Stored in file"
  },
  "notification": "Error details sent to the developer."
}

In this example:

  • errorInfo: Contains details about the error, including the message, type, and additional details.
  • log: Logs the error with the defined log level and storage location.
  • notification: Specifies that a notification has been sent (if configured).

Discussion