-
Notifications
You must be signed in to change notification settings - Fork 877
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
MappingSubscriber should halt upon any Exception #4205
base: master
Are you sure you want to change the base?
Conversation
Catching only RuntimeException means anything awaiting a result from a Publisher will hang indefinitely, even after a coroutine has ended exceptionally.
Yes, Kotlin does have built-in exceptions that do not inherit from |
@@ -69,7 +69,7 @@ public void onNext(T t) { | |||
if (!isCancelled) { | |||
try { | |||
delegateSubscriber.onNext(mapFunction.apply(t)); | |||
} catch (RuntimeException e) { | |||
} catch (Exception e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we catch Throwable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not? I don't think we can catch too many exceptions here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@polyatail can you update the PR and add Throwable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
is there any update about this issue? |
Please merge this. |
Motivation and Context
When using
SdkPublisher.map
, if the mapping function throws an exception that does not inherit fromRuntimeException
(which often is the case in Kotlin), anything awaiting a result from the Publisher will hang indefinitely, even though the coroutine has ended exceptionally.Modifications
This change catches and terminates on all exceptions.
Testing
Screenshots (if appropriate)
Types of changes
Checklist
mvn install
succeedsscripts/new-change
script and following the instructions. Commit the new file created by the script in.changes/next-release
with your changes.License