Catch Error from final node in webhook response

My webhook is connected to an HTTP module that makes a request to an API.

There are times when the API returns an error because it has no data.

Error: StatusCodeError: 404 - {"header":{"statut":404,"message":"No elements found with those query parameters"}}
at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/HttpRequest.node.js:762:27)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/src/WorkflowExecute.js:369:47

Is there a way to catch that Error back in the webhook ?

I tried with all different response modes (ā€œlast nodeā€ or ā€œon receivedā€) and with all response data (all entries, first entry json, first entry binary) => But the response I get is always my initial request.

Any idea how to solve that ? Is that doable ?

Hi @alexsonnay! You are right, youā€™d need to select ā€˜Last Nodeā€™ from the Response Mode dropdown list in the Webhook node. Next, in the HTTP Request Node, youā€™d have to add the Ignore Response Code and the Full Response field using the Add Options button and toggle them to active (green). Youā€™d also need to select ā€˜Fileā€™ from the Response Format dropdown list. Iā€™ve attached a workflow below which illustrates this.

In case you donā€™t want to set the Ignore Response Code to true, you might want to take a look at the Error Trigger node.

Hope that helps, have fun! :slight_smile:

Thanks :rocket::rocket::rocket::rocket::rocket::rocket::rocket::rocket:

1 Like