k-yle/sACN

Callback throws Error: addMembership EADDRNOTAVAIL

schw4rzlicht opened this issue · 1 comments

When calling new Receiver() with an interface that doesn't exist, Socket.addMembership() throws Error: addMembership EADDRNOTAVAIL which is not catchable since it happens in the callback.

Wouldn't it be a better idea to add a start() method to Receiver which returns a promise so we could handle the error properly?

k-yle commented

I've added a new "error" event which is emitted. You can listen using

sACN.on('error', (err) => {
  // trigged if there is an internal error (e.g. the supplied `iface` does not exist)
});

I prefer this paradigm over an async start() method since this whole module is built around nodejs's EventEmitter.