Skip to content
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

Update send() to forward all errors #22

Merged
merged 1 commit into from
Mar 9, 2023

Conversation

buildbreaker
Copy link
Contributor

@buildbreaker buildbreaker commented Mar 9, 2023

Resolves #23

I'm working on getting some Android based unit tests working which should validate this behavior. However, I think it might incur some risk for our release tomorrow so I will have to do that work in a separate PR.

@@ -56,8 +56,12 @@ class Stream(
if (isClosed()) {
return Result.failure(IllegalStateException("cannot send. underlying stream is closed"))
}
onSend(buffer)
return Result.success(Unit)
return try {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the contract with the underlying network -- we expect onSend to be unsafe and will handle that failure appropriately.

@@ -193,7 +193,7 @@ internal class PipeDuplexRequestBody(
bufferedSink.writeAll(buffer)
bufferedSink.flush()
}
} catch (e: Throwable) {
} finally {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't swallow these errors anymore and let the caller handle errors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Avoid swallows in streaming sends
2 participants