-
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
Strange catchError behavior inside of concat #3740
Comments
Thanks, @hansl for pointing this one out. |
|
I've had a quick look at this. It seems to be related to the In The problem is that those conditions are met only for the It works like this:
Note that the A possible fix - which fixes the repro - could be something like this, but it needs more thought: export class InnerSubscriber<T, R> extends Subscriber<R> {
private index = 0;
constructor(private parent: OuterSubscriber<T, R>, public outerValue: T, public outerIndex: number) {
super();
this.syncErrorThrowable = parent.syncErrorThrowable;
}
// ...
} |
@cartant, at first blush, that seems like the correct solution. The only thing is we'd need to make sure that the InnerSubscriber's syncErrorThrowable property was updated at the appropriate time to be set back to false (meaning it would need to be linked to the parent's syncErrorThrowable property). So perhaps a getter propertly on the InnerSubscriber that was backed by (I haven't verified any of this, just thinking this might be the better way to approach this) |
Yeah, using a getter would be the way to go.
It's also assigned here, so it definitely has to be a getter. |
/** @internal */ syncErrorValue: any = null;
/** @internal */ syncErrorThrown: boolean = false;
/** @internal */ syncErrorThrowable: boolean = false;
No, that's not necessary. It doesn't even make sense, as the outer (the parent) subscribes to the inner. |
As evident in the previous stream-of-consciousness comment, I've been messing with the above-mentioned fix. I'm inclined to change my mind about it, as it's really only related to the deprecated sync-error handling and that doesn't even work with the fix applied. If the inner subscriber's Given that this behaviour is still broken and that #3560 was closed, I think a better fix might be to use a different test for deciding between a Instead of this: sink.add(this.source || !sink.syncErrorThrowable ? this._subscribe(sink) : this._trySubscribe(sink)); It could be something like this: const noTry = config.useDeprecatedSynchronousErrorHandling ?
this.source || !sink.syncErrorThrowable :
this.source;
sink.add(noTry ? this._subscribe(sink) : this._trySubscribe(sink)); This solves the problem - for non-deprecated usage - in a less complicated way. |
Your solution looks solid, @cartant... proceed with the fix if you're so inclined. |
RxJS version: 6.2.0
Code to reproduce:
Try it out on this Stackblitz
Expected behavior:
Logs
Actual behavior:
Logs
Additional information:
Appears to have to do with the difference in behaviors between when an Observable is lifted, vs when it's not WRT
syncErrorThrowable
.The text was updated successfully, but these errors were encountered: