caolan / caolan/highland

Cannot write to stream after nil (async errors handler)

Open
#593 5 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

I get a Promise rejection `Cannot write to stream after nil` and the stack trace shows `node_modules/highland/lib/index.js:1430:19`. The code is like this, and the Promise rejection happens when `push(e)` happens. How can I fix this code?

```js
await new Promise((resolve, reject) => {
highland(ids)
.map(id => highland(download(id)))
.mergeWithLimit(limit)
.errors(async (e, push) => {
if (cannotContinue(e))) {
push(e)
}
})
.stopOnError(reject)
.done(resolve)
})
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.