{ "nodes": [ { "id": "email-workflow-failure-details-0", "name": "On Error", "type": "n8n-nodes-base.errorTrigger", "position": [ 880, 900 ], "parameters": {}, "typeVersion": 1 }, { "id": "email-workflow-failure-details-1", "name": "Prepare failure details", "type": "n8n-nodes-base.code", "typeVersion": 2, "parameters": { "mode": "runOnceForAllItems", "jsCode": "const x=$input.first().json,w=x.workflow??{},e=x.execution??{},err=e.error??{};if(typeof w.name!=='string'||!w.name)throw Error('Missing workflow name');const name=w.name.replace(/[\\r\\n]+/g,' '),v=x=>typeof x==='string'&&x?x:'not available';return [{json:{subject:'Error in workflow: '+name,body:'Workflow: '+w.name+'\\nExecution URL: '+v(e.url)+'\\nLast node: '+v(e.lastNodeExecuted)+'\\nError message: '+v(err.message)+'\\nStack trace: '+v(err.stack)}}];" } }, { "id": "email-workflow-failure-details-2", "name": "Gmail", "type": "n8n-nodes-base.gmail", "position": [ 1120, 900 ], "parameters": { "sendTo": "YOUR_ALERT_EMAIL", "subject": "={{ $json.subject }}", "message": "={{ $json.body }}", "emailType": "text", "options": { "appendAttribution": false } }, "typeVersion": 2.1 } ], "pinData": {}, "connections": { "On Error": { "main": [ [ { "node": "Prepare failure details", "type": "main", "index": 0 } ] ] }, "Prepare failure details": { "main": [ [ { "node": "Gmail", "type": "main", "index": 0 } ] ] } }, "name": "Email Workflow Failure Details", "active": false, "settings": { "executionOrder": "v1" } }