Last active
June 15, 2017 06:03
-
-
Save stelcheck/7c57c5b56748302d2aa71e8bce95f376 to your computer and use it in GitHub Desktop.
net: EADDRINUSE is an uncatchable error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const net = require('net') | |
try { | |
net.createServer((args) => console.log(...args)).listen('hello', (error) => console.error('listen error', error)) | |
} catch (error) { | |
console.error('Uncaught listen error', error) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To reproduce, run once, CTRL-C, then run once again. You should see the following output on the second run
As you can see, the error is neither caught by the try/catch nor passed to the
listen
callback.