node icon indicating copy to clipboard operation
node copied to clipboard

"Ambiguous" error with tls.connect() against a non-TLS listener

Open user447463 opened this issue 11 years ago • 1 comments

The following code will pass an "ambiguous" error object.

require('tls').connect(80, 'www.google.com', function() {
    console.log('success');
}).on('error', function(error) {
    console.log(error);
});

It is not (easily) determinable what the actual reason for the error was (refused connection, cipher problem or - as in this case - no TLS supported or something else).

user447463 avatar Mar 10 '15 14:03 user447463

Hi @user447463! Thanks for opening this issue. Unfortunately, the tls module doesn't handle errors well at all - it seems hard to serialize them from the OpenSSL bindings. This is definitely something we would like to see improved with a pull request (please submit one if you would like to help!), but unfortunately this issue isn't very actionable as is. I'll close for now. Thank you!

brendanashworth avatar Jun 24 '15 06:06 brendanashworth