-
-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Catch and emit error on socket.addMembership #34
Conversation
…ork connection) so that library doesn't crash
We've hit this in Beaker (beakerbrowser/beaker#323). @mafintosh can you merge? |
6.1.1 |
Thanks!
…On Tue, Mar 7, 2017 at 1:17 AM, Mathias Buus ***@***.***> wrote:
6.1.1
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#34 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABNhU89PY0-2tZsSo_eOFPE-ajzXGaDVks5rjQSMgaJpZM4KEd3w>
.
|
Hey! I think this is what I was hitting in watson/bonjour#38 Edit: 💔 actually this patch was the cause of my problem. What you have now is a socket that's created, an I can do the following:
However I don't think there's any guarantee that my error handler will definitely be added before a
Obv that is a breaking API change, however. See: https://nodejs.org/api/events.html#events_error_events Happy to open a new issue to address this, just let me know and I'll move the discussion. |
If we would like to fix this in a backward-compatible way, possibly: const myMdns = mdns({autoOpen: false}); // socket will not be opened automatically, defaults to true for compat
myMdns.on('error', err => console.warn("please don't crash my nodejs process"));
myMdns.listen(); // new method to open the socket, if autoOpen: false option was given in ctor |
socket.addMembership throws an error on network issues (no network). This commit catches and emits the error so that the error can be handled elsewhere instead of crashing the library.