max-mapper / max-mapper/multiplex
Passing through errors from underlying streams
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 143
- Forks
- 25
- PR merge metrics
- No merged PRs in 30d
Description
Been using multiplex for a while and loving it, but I'm not sure that stream error handling is well dealt with by the package. This hasn't been a problem before, but recently WebRTC data channels have been popping up edge cases that are giving my error handling a really solid run.
With some tinkering I found that modifying [line 107](https://github.com/maxogden/multiplex/blob/master/index.js#L107) to the following code:
``` js
decode.pipe(through.obj(decoder)).on('error', dup.emit.bind(dup, 'error'))
```
the problem goes away but I'm not sure that is all that is required to ensure that unhandled errors in the local streams are bubbled up to a place in which they can be handled.
Any thoughts on what the _right_ way to handle this is before I go all gangbusters with a PR?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at index.js line 107 and trace how decode, through.obj(decoder), and dup are connected. Use the reported stream-error scenario as a focused reproduction, and consider the work complete when errors from local streams reach a handler that can process them.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100