Simulating Errors for Debug Purposes

Describe the problem/error/question

Hello. I’m new to n8n and come from a coding background. Something I was taught was to handle errors where ever they can occur. I like the n8n feature of being able to send errors through their own output but I’m struggling with debugging/simulating these errors. In some cases there’s an error message - but the errors are always different structures so I can’t just assume there will be like an error key (if an error is sent at all - in some cases like Google Sheets I found the error object will be empty) - further I can’t figure out how to cause some nodes to error in the first place (like the Switch and If nodes, they have the option to error but what is a scenario where these error and how can I simulate it)?

Again, I’m super new to n8n so maybe I’m missing the testing features for power users - if anyone could point me in the right direction it would be greatly appreciated!

What is the error message (if any)?

N/A

Please share your workflow

N/A

Information on your n8n setup

  • n8n version: 1.94.1
  • Database (default: SQLite): SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default
  • Running n8n via (Docker, npm, n8n cloud, desktop app): docker
  • Operating system: ubuntu

It’s not easy to debug your worflow. But it seems like you’re looking for a persistent way to handle errors in your workflows, regardless of which node caused the error.
Here’s a common approach:

First, create a workflow that is triggered by an error. This workflow will be responsible for handling the error, for example, by sending a notification.
I usually create the worflow with Error trigger


To send the errors to my telegram chat

And then set the error workflow in workflow settings (of the workflow you need to debug)
To do that open the executions and hit the “Which executions is this worflow saving”.


And then set the Error workflow to the one with Error tirgger
image

Hope this will helps.