question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Continue stream after error

See original GitHub issue

I wonder if there is a way to handle single error in the stream and continue? The only way i found is to make concatMap + recoverWith + most.empty()

stream$
    .concatMap(x => most.just(x)
        .map(mayThrow)
        .recoverWith(e => {
            console.log('CAUGHT', e);
            return most.empty();
        })
    )
    .forEach(x => console.log('result', x));

Would be nice to have method like handleError to do side effects and move on Or maybe tapErrors and filterErrors similar to tap and filter Or even concatMapError to replace each error with a stream

stream$
    .map(mayThrow)
    .tapErrors(e => console.log('CAUGHT', e))
    .filterErrors(e => e.message !== 'Known error')
    .forEach(x => console.log('result', x));

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:11 (9 by maintainers)

github_iconTop GitHub Comments

4reactions
standycommented, May 3, 2016

Check out this talk by Scott Wlaschin: https://youtu.be/E8I19uA-wGY?t=42m52s (about error handling from 42m) Best approach I’ve ever seen

2reactions
standycommented, May 2, 2016

Main problem i have met about errors is that stream is ending right after. All I can do is continue with another stream Cant do something like that with most.js (but can with any other frp library)

expected:  1-2-3-e-5-...
actual:    1-2-3-e|

To be less abstract, example: I want to make a method, which take a stream of questions, and return a stream of answers (just fetch from wikipedia). So I want method like that: getAnswers(questions$). But fetch can throw, so i need to handle error inside this method, that mean signature must be like that getAnswers$(questions$, onError)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Catch, Recover, and Continue RxJS Streams After An Error
RxJS automatically kills streams when errors occur. This is hard coded. The solution: use disposable streams.
Read more >
How to catch error and continue executing a sequence in RxJs?
This does not seem to work in RxJS v6. I tried migrating the code and the observable completes after the error is caught....
Read more >
Error handling with reactive streams. | by Kalpa Senanayake
Meaning it will stop the sequence. Even if an error-handling operator is used, it does not allow the original sequence to continue.
Read more >
Continue running ZStream after an error #7349 - zio/zio - GitHub
It doesn't make sense to restart the whole stream with in-flight elements in various processing stages just for a single failure. .either.mapZIO ...
Read more >
RxJs Error Handling: Complete Practical Guide
As we can see, the stream emitted no value and it immediately errored out. After the error, no completion occurred. Limitations of the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found