-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Feature request: add onErrorResumeNext
#1665
Comments
Thanks @trxcllnt those are awesome resources. I'm still having a bit of trouble here, so in my use case I'm creating a cold observable from an array. Trying to use catch it looks like it replaces the rest of the sequence rather than replacing just that single item. Given that, is there any way to get the remaining sequence from .catch((e, o) => {
console.log('Handling error: ' + e);
return Rx.Observable.from([1,2,3,4]); // any way to recover and resume the existing cold observable sequence?
}) Since my Observable has a number of transformations I'd like to shortciruit the processing of this current item and just proceed to the next one. I haven't been able to tease out how I would do this right now without keeping track of the items I've processed or without something like |
Yeah, we need to add |
onErrorResumeNext
Thanks! |
Hey, I can't understand how onErrorResumeNext solves @danhyun's issue. |
Just to add, if I understood the RXJava operator right, what we need is: onExceptionResumeNext |
You can use 'use strict'
const Rx = require('rxjs')
const $ = new Rx.Subject()
const throwOnEven = x => {
if (x % 2 === 0) throw new Error(x)
return x
}
$
.map(throwOnEven)
.catch((e, stream) => stream)
.subscribe(x => {
console.log(`odd: ${x}`)
// this is uncatched, still
if (x > 4) throw Error('shit')
}, e => {
console.log('fatal error', e)
})
try {
$.next(1)
$.next(2)
$.next(3)
$.next(4)
$.next(5)
} catch (e) {
console.log({outer:e}) // { outer: Error('shit') }
}
// odd: 1
// odd: 3
// odd: 5
// { outer: Error('shit') } |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
According to https://github.com/ReactiveX/rxjs/blob/master/MIGRATION.md we're to file an issue or PR requesting feature additions to RxJS5.
I'd like to have something like
onErrorResumeNext
http://xgrommx.github.io/rx-book/content/observable/observable_methods/onerrorresumenext.html or the ability to continue with the next emitted item.In my specific usecase I'm doing something like this:
Related JSBin http://jsbin.com/monuyegatu/1/edit?html,js,console
The text was updated successfully, but these errors were encountered: