-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
toPromise() does not propagate errors properly #683
Comments
This is a bug in map, not in toPromise. map shouldn't let you map to nil in
the first place.
This is pretty easy to fix. But in the meantime, if you're doing this to
early-terminate a stream, you should be using filter instead of (or in
addition to) map.
…On Sat, Jun 8, 2019, 3:22 AM NoxPhoenix ***@***.***> wrote:
There are certain situations where the toPromise method will resolve
successfully with a highland internal error being thrown.
to recreate...
_([1])
.map(x => _.nil)
.toArray(arr => console.log);
Will error Error: Cannot call next after nil
however....
_([1])
.map(x => _.nil)
.collect()
.toPromise(Promise)
.then(console.log);
Will just log an empty array to the console.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#683?email_source=notifications&email_token=ABRDEZKRCJZVOW5TGZODG2TPZK7QBA5CNFSM4HV2BKN2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GYKTCWQ>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABRDEZKD5KYVXCCC64PXBM3PZK7QBANCNFSM4HV2BKNQ>
.
|
Oh ok. I was digging through the code for toPromise and collect to try and find it myself. Good to know you think it's an easy fix! If you let me know the premise of what needs to be added, I will open a PR for it. |
waiting for a PR? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There are certain situations where the toPromise method will resolve successfully with a highland internal error being thrown.
to recreate...
Will error
Error: Cannot call next after nil
however....
Will just log an empty array to the console.
The text was updated successfully, but these errors were encountered: