How to handle Error: getaddrinfo ENOTFOUND

Is there a way to handle ENOTFOUND in a way that doesn’t break the script?
I have a service that I’m calling which may or may not be present, so I want to script around the availability of this endpoint. Unfortunately the script dies when it tries to call the unavailable service. I really want it to simply error in a way that I can detect and handle in the script.

Hey @MmmmMmmm :wave:

As I understand it, you want to validate a request URL availability before sending your request, is that correct?

In that case, I suppose you can include something like following script in your pre-request script and modify URL value stored in environment variable:

Hope this helps! :smiley:

Huge thanks Taehoshino !! Really saves me from a nasty workaround.

1 Like