HTTPS request throws uncatchable error #38

danmactough opened this Issue Jun 22, 2011 · 4 comments


None yet
2 participants

danmactough commented Jun 22, 2011

An https request on an invalid url throws an uncatchable error. Example url: https://f


mikeal commented Jun 28, 2011

can you give me some more info, it looks like this ticket got cut off


danmactough commented Jun 29, 2011

Confused me when I came back to look at it, too! But I actually meant that (invalid) url. More info was definitely needed, though.

What happens is when you try to fetch an invalid URL via HTTPS, the error is not catchable in a try/catch.


var request = require('request');
var f = request.get('https://f');
} catch(e) {

        throw arguments[1]; // Unhandled 'error' event
Error: ENOTFOUND, Domain name not found
    at IOWatcher.callback (dns.js:74:15)

mikeal commented Jun 29, 2011

ahhhhhh, ok.
well, you won't ever be able to try/catch, because we don't know that the domain is invalid until we pass it to the socket.
that said, the error should be sent to the callback if available and if not emitted on the Request object, it should not be getting caught globally from the socket.


danmactough commented Jun 30, 2011

Sorry, that was a bad example. I created a good example, but it appears that this was an upstream bug in stream.pipe() that was fixed in node v.0.4.9 as my examples work as expected after updating. I'll mark this as closed.

#1095 error handling bug in stream.pipe() (Felix Geisendörfer)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment