-
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
Improving catch
, possibly removing retryWhen
#141
Comments
cc/ @mattpodwysocki @staltz @trxcllnt for thoughts. This was something I came up with while reimplementing the |
@zenparsing and @jhusain may find this issue interesting for their es-observable efforts as well, since it's a basic operator. |
So in working with this and talking with George Campbell at Netflix, it seems like the optional arguments should/could be: myObservable.catch((err:any, source:Observable<T>, caught:Observable<any>) => Observable<any>) => Observable<any> Where the arguments are as follows:
With these arguments one can do just about any type of retry or catch handling. However, it's worth pointing out that any of this could be accomplished with closure as well. It's just that inside of the I'm torn on this one:Pros:
Cons:
I'm sure there are more cons... I'm waiting for others to weigh in. |
To elaborate: ordinary catch: myObservable.catch(err => {
if(isBadError(err)) {
throw err;
}
return Observable.value('something happened, but here is a nice response');
}); retryWhen equivalent: myObservable.catch((err, source, caught) => {
if(totallyWannaRetry(err)) {
return caught;
} else {
throw err;
}
}) |
I'm not sure about the utility of the second argument being the |
…eneration * 'master' of https://github.com/ReactiveX/RxJS: feat(catch): add catch operator, related to ReactiveX#141, closes ReactiveX#130 Cleans up ReplaySubject naming. Uses splice to trim from events list. Make ReplaySubject check subscriber.isUnsubscribed while replaying events. feat (ReplaySubject): Add basic ReplaySubject implementation. Omit scheduling from source Observables to better compare versions. feat (defer): Add Observable.defer Updates macro perf URLs relative to new directory hierarchy. Adds micro-benchmark performance tests. Updates macro perf URLs relative to new directory hierarchy. feat (defer): Add Observable.defer Adding thisArg and bindCallback Adds micro-benchmark performance tests. Adds Subscriber instanceof check inside Observable's public subscribe. Resolve operator PR merge conflicts. Fix TS compiler errors related to SwitchLatestSubscriber Cleans up shared-subscriber routing logic in intermediate Subscribers. Ups the interval of the takeUntil test. feat (takeUntil): add takeUntil operator
The proposal is a non-breaking change to catch:
EDIT: see comment below
The text was updated successfully, but these errors were encountered: