Errors thrown if pipeline contains non-Highland streams
- Dominant language
- JavaScript
- Stars
- 3.4k
- Forks
- 145
- PR merge metrics
- No merged PRs in 30d
Description
I may be doing something incorrectly, but I'm having difficulty getting errors to propagate down a pipeline if that pipeline contains a non-Highland stream. E.g. this works as expected:
``` js
var mapStream = require( 'map-stream' );
var through = _.pipeline(
_.map(function () {
throw new Error( "Oh no!" );
}),
_.map(function (x) {
return x;
})
);
var _([1]).pipe(pipeline).stopOnError(function () {
console.log( "I will print out just fine." );
}).resume();
```
But if I change the second map in the pipeline to a one from [map-stream](https://github.com/dominictarr/map-stream) (or another non-Highland source), the error will be thrown instead:
``` js
var through = _.pipeline(
_.map(function () {
throw new Error( "Oh no!" );
}),
_(mapStream(function ( x, cb ) {
cb( null, x );
}))
);
var _([1]).pipe(pipeline).stopOnError(function () {
console.log( "I will never be called." );
}).resume();
```
In my use case, the streams are dynamically added to the pipeline at runtime from various sources, some of which will not be Highland streams.
What is a better approach for getting the desired error propagation when using a dynamic set of mixed Highland and Node streams?
Contributor guide
Research direction
Start by reproducing the two pipeline examples with Highland and map-stream, comparing error propagation through _.pipeline and stopOnError. Trace how mixed Highland and Node streams are adapted and define done as errors from an upstream Highland stream reaching the downstream stopOnError handler in the dynamic mixed-stream case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100