kappa-db / multifeed

Multi-writer hypercore.
135 stars 27 forks source link

Fix unhandled error #39

Closed gmaclennan closed 4 years ago

gmaclennan commented 4 years ago

merge #38 before this.

An error in the multiplexer was emitting an error event on the multiplexer instance. There is no way to handle this error - only mux.stream is returned from replicate() and there is no mux.on('error') in the replicate() method. This causes an unhandled error in Node, so things just break on error.

I don't think we need to emit errors on the multiplexer instance, because the error is emitted on the stream returned from the replicate() function which is handled in https://github.com/kappa-db/multifeed/blob/master/mux.js#L140 this.stream.destroy(err), so error handling is done via the stream not the multiplexer instance.

hackergrrl commented 4 years ago

Nice. I fixed this in the hypercore8 branch I've been working on. It'd be good to get it in now though. Thanks!