watson / bonjour

A Bonjour/Zeroconf protocol implementation in JavaScript
MIT License
627 stars 146 forks source link

Catch error event when multicastdns emit some error #49

Open feichao opened 6 years ago

feichao commented 6 years ago

Used in Electron, there is no way to catch some internal multicastdns error, when some error occurs, the main thread is crashed. This PR adds a default error callback when user not provide.

okdistribute commented 5 years ago

this would be nice! @watson

okdistribute commented 5 years ago

This issue is caused by service emitting an error before any error handler can be attached to it: https://github.com/watson/bonjour/blob/master/lib/registry.js#L21

Another way to fix this is to not emit from the service, but from bonjour