Essentially it’s like purposefully throwing an error in Javascript where you would normally use the throw statement. Now in the case of n8n, you need something to catch the error as this basically crashes the workflow on purpose with a custom error. To make this work, look at the example below. PS this only really works when the workflow triggers in production and NOT while clicking the test workflow button.
We need to set the properties of the workflow to tell it which workflow is responsible for catching the error. In this case I set it to the same workflow simulating a try/catch. This could be any other workflow, for exampe in my production setups, I have a single “error workflow” I use to ctach all errors from all workflows and then email myself the errors with execution data referenced.
Once you enable this workflow and the scheduler trigger, you’ll see one execution with error and another where the Error trigger picked up the error details:


