How to "branch" if HTTP request failed?

Edit: Actually, just solved a lot of problems by enabling “Full Response” in the HTTP Request node, and putting an “if” in front to check the statusMessage is equal to “OK” :slight_smile:

Describe the issue/error/question

I want to perform an HTTP request. If for some reason the HTTP request fails, I want to update something in my database

Is there any sort of Try/Catch functionality? Or an “if” that checks if the previous node ran ok?

Start -> HTTP request -> If success: Continue normally
                         If failure: Update something on database (e.g.: increment an integer "failures" on the database)

Please note I don’t want to stop the whole workflow on error. This HTTP request is just a tiny part of it, and a request failure is something that I want to handle within the workflow by design - hence I’m not totally convinced about the Error Trigger to start a new Workflow

To give a bit of context, imagine this is a sort of “website uptime monitoring” thing. I iterate through all websites present in the database and do an HTTP request for each of them - I want to mark which ones are up, and which ones are down. Such scenario is one example where a HTTP failure makes sense to be handled within the workflow

Edit: Would be nice to get the HTTP status code as well

1 Like

Hey @fishnux,

Nice to see you have worked it out with the Full Response option :smile:

Would there be a way to get the HTTP request that called the error? Only thing I’m able to do currently is work with the error response, which doesn’t really help me.

@PopRockRoll current versions of n8n would send request details to the browser console when manually executing the HTTP Request node, in case you want to take a closer look:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.