caolan / caolan/highland

toPromise() does not propagate errors properly

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

Description

There are certain situations where the toPromise method will resolve successfully with a highland internal error being thrown.

to recreate...
```javascript
_([1])
.map(x => _.nil)
.toArray(arr => console.log);
```
Will error `Error: Cannot call next after nil`

however....
```javascript
_([1])
.map(x => _.nil)
.collect()
.toPromise(Promise)
.then(console.log);
```
Will just log an empty array to the console.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the toPromise and collect entry points using the reproduction in the issue, then compare their error handling with the toArray behavior. Done means the Promise rejects with the Highland internal error instead of resolving with an empty array.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.