-
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
Observable.ajax halts when error callback is not given to progressSubscriber #2428
Comments
so current implementation seems expect progressSubcriber to fully implement /cc @trxcllnt for visibility. |
The SafeSubscriber logic is technically correct, I'm not 100% on the right fix. On the one hand, we could fix AjaxObservable to ignore (or catch and forward) the error thrown by calling I'm also tempted to question why |
I was trying to get progress event here #2424 , but both of two implement have some problem. Observable.create((subscriber: Subscriber<ProgressEvent>) => {
const ajax$ = Observable.ajax({
url: host,
body: blob,
method: 'post',
crossDomain: true,
headers: { 'Content-Type': 'application/octet-stream' },
progressSubscriber: subscriber
})
.takeUntil(this.pause$)
.repeatWhen(() => this.resume$)
const subscription = ajax$.subscribe()
return () => subscription.unsubscribe()
})
.retryWhen(() => this.resume$) In this case I can't get the ajax$ result, because subscriber was stoped before it can emit ajax result. const host = `${apiHost}/upload/chunk/${meta.fileKey}?chunk=${index + 1}&chunks=${meta.chunks}`
const subscriber = new Subscriber()
return Observable.ajax({
url: host,
body: blob,
method: 'post',
crossDomain: true,
headers: { 'Content-Type': 'application/octet-stream' },
progressSubscriber: subscriber
})
.takeUntil(this.pause$)
.repeatWhen(() => this.resume$) In this case I can't retry or repeat progressSubscriber. |
Ugh... it shouldn't be Either way, It seems like the proper thing to do would be to send any unhandled errors to the main subscription. Thoughts? |
: I'm also in favor of this approach. |
Any advice on what change is needed to make this work? I'm happy to create a PR. |
whoo, so I'm confused. I just realised that we're talking about |
@awhillas I'm seeing the same when |
I am reporting the same issue.
|
For folks looking, a workaround is to use
|
This has been fixed in #5618 |
RxJS version:
5.2.0
Code to reproduce:
in https://github.com/ReactiveX/rxjs/blob/master/spec/observables/dom/ajax-spec.ts
Expected behavior:
Test should pass
Actual behavior:
Additional information:
Three confusing bits:
Should I just pass a noop function to bypass this behaviour
Not sure if progress subscriber should throw the ajax error in ajax observable https://github.com/ReactiveX/rxjs/blob/master/src/observable/dom/AjaxObservable.ts#L366
Not sure whether Subscriber logic is correct in https://github.com/ReactiveX/rxjs/blob/master/src/Subscriber.ts#L222-L224
it still throws when
_parentSubscriber
is notsyncErrorThrowable
?The text was updated successfully, but these errors were encountered: