Throw an error code with Respond To Webhook node

Hi there :slight_smile:

I create all my APIs with n8n and it rocks.
Most of my API are made with a webhook node as a starter, and respond to webhook as a finisher.
I use a lot of HTTP nodes to.
Sometimes my API Calls fails.
Then i use “continue - error output” parameters, and use again a respond to webhook node to send the error back.

My issue is that the respond to webhook node send a 200 with an error.message.
Is there a way to throw an error with a respond to webhook node ?

(hope this is clear ^^)

It looks like your topic is missing some important information. Could you provide the following if applicable.

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

Yes, there is a way.

Under the respond to webhook extra options you can specify a specific status code, so you can return 400 or 500 status kits for your case depending on where the issue happened.

I just posted about custom API air handling that checks the parameters and returns custom error codes based on that with a schema. That post is below. Maybe the work flow attached will help you out

2 Likes

Sorry for the question, RTFM :smiley:

Thank you for your help

No problem and you’re welcome!