Is there a way to fail a function node on purpose?

Describe the issue/error/question

I’m using the Function node and I would like to know if there is a way to return a value or something that causes the node to fail.
In case something happens in my code I want it to trigger a failure and cause the node and the workflow to fail.

Hey @Itay,

You can use the throw statement for this.

1 Like

But make sure to actually throw an actual Error and not just a string as on the linked example page.

Example:

throw new Error('This is my error');
1 Like