{
  "name": "Error handler",
  "nodes": [
    {
      "parameters": {},
      "id": "fe3d98ee-7d85-4e85-a4e2-bef1b6b605fe",
      "name": "On workflow error",
      "type": "n8n-nodes-base.errorTrigger",
      "typeVersion": 1,
      "position": [
        0,
        300
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "d490f729-991f-4e78-8123-87ede5a234cb",
              "name": "workflow",
              "value": "={{ $json.workflow.name }}",
              "type": "string"
            },
            {
              "id": "f0f06661-143b-47aa-a844-e66df426e437",
              "name": "node",
              "value": "={{ $json.execution.lastNodeExecuted }}",
              "type": "string"
            },
            {
              "id": "81355aba-c778-4edc-a578-a4fadffd06f0",
              "name": "error",
              "value": "={{ $json.execution.error.message }}",
              "type": "string"
            },
            {
              "id": "790edb93-6d79-42ee-9607-5e46c7489490",
              "name": "url",
              "value": "={{ $json.execution.url }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "f713a718-4a3f-45ec-8696-6798e30b0aae",
      "name": "Format alert",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        240,
        300
      ]
    },
    {
      "parameters": {
        "select": "channel",
        "channelId": {
          "__rl": true,
          "value": "#ops-alerts",
          "mode": "name"
        },
        "text": "=Workflow failed: {{ $json.workflow }} at {{ $json.node }}\n{{ $json.error }}\n{{ $json.url }}",
        "otherOptions": {}
      },
      "id": "a515dc24-b918-43be-9094-cf42846ca9a9",
      "name": "Alert #ops",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.2,
      "position": [
        480,
        200
      ]
    },
    {
      "parameters": {
        "schema": {
          "__rl": true,
          "value": "public",
          "mode": "list"
        },
        "table": {
          "__rl": true,
          "value": "workflow_errors",
          "mode": "list"
        },
        "columns": {
          "mappingMode": "autoMapInputData",
          "value": {}
        },
        "options": {}
      },
      "id": "63ccaa86-2a7c-4e9e-a4ac-f3d81e5f9212",
      "name": "Store error",
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2.5,
      "position": [
        480,
        400
      ]
    }
  ],
  "connections": {
    "On workflow error": {
      "main": [
        [
          {
            "node": "Format alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format alert": {
      "main": [
        [
          {
            "node": "Alert #ops",
            "type": "main",
            "index": 0
          },
          {
            "node": "Store error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {}
}