caolan / caolan/highland

Get the data event who caused an error

Open
#455 3 comments 2 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
3.4k
Forks
145
PR merge metrics
No merged PRs in 30d

Description

How could I get the data event that caused an error? For example:

``` javascript
const _ = require('highland');

_([
{id: 1, data: '{"a":100}'},
{id: 2, data: '{b:200}'},
{id: 3, data: '{"c":300}'}
]).map(function(v) {
v.parsed = JSON.parse(v.data);
return v;
}).errors(function(err, push) {
// how to get the object who caused the error?
console.log(err);
}).each(console.log);
```

The second data event {id: 2, data: '{b: 200}'} in the stream caused a SyntaxError. Is there a way that I can get it in the error handler?

Contributor guide

Open the contributing guide

Research direction

Start with the map callback and errors(err, push) handler shown in the example, then trace Highland’s stream error propagation. Check the existing error-handling documentation and implementation to determine whether the originating value is preserved. Done means providing a documented, supported answer or defining the API change needed to expose it.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
stream-processing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.