max-mapper / max-mapper/multiplex

Passing through errors from underlying streams

Open
#16 1 comment 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.