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

[WIP] Timeout exception #1630

Merged
merged 6 commits into from
Nov 17, 2022
Merged

[WIP] Timeout exception #1630

merged 6 commits into from
Nov 17, 2022

Conversation

micsza
Copy link
Contributor

@micsza micsza commented Nov 14, 2022

Before submitting pull request:

  • Check if the project compiles by running sbt compile
  • Verify docs compilation by running sbt compileDocs
  • Check if tests pass by running sbt test
  • Format code by running sbt scalafmt

@micsza micsza linked an issue Nov 15, 2022 that may be closed by this pull request

* `ConnectException`: when a connection (tcp socket) can't be established to the target host
* `ReadException`: when a connection has been established, but there's any kind of problem receiving the response (e.g. a broken socket)
* `TimeoutException`: a discriminated sub-kind of `ReadException` for timeout fails
Copy link
Member

Choose a reason for hiding this comment

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

sub-type - kind is a different thing :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Corrected.

Pask423
Pask423 previously approved these changes Nov 15, 2022
@@ -228,7 +228,7 @@ class FinagleBackend(client: Option[Client] = None) extends SttpBackend[TFuture,
Some(new SttpClientException.ConnectException(request, e))
case e: com.twitter.finagle.ChannelClosedException => Some(new SttpClientException.ReadException(request, e))
case e: com.twitter.finagle.IndividualRequestTimeoutException =>
Some(new SttpClientException.ReadException(request, e))
Some(new SttpClientException.TimeoutException(request, e))
Copy link
Contributor

Choose a reason for hiding this comment

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

For sure it is the only backend that needs this change ?

Copy link
Member

Choose a reason for hiding this comment

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

@Pask423 there are also individual adapters for Akka and Armeria in this PR. Other backends probably just emit standard java timeout exceptions.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok then, my bad

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, the unchanged backends emit java native exceptions.

@Pask423 Pask423 self-requested a review November 15, 2022 13:38
Copy link
Member

@kciesielski kciesielski left a comment

Choose a reason for hiding this comment

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

question Can you add tests for backends?

@@ -228,7 +228,7 @@ class FinagleBackend(client: Option[Client] = None) extends SttpBackend[TFuture,
Some(new SttpClientException.ConnectException(request, e))
case e: com.twitter.finagle.ChannelClosedException => Some(new SttpClientException.ReadException(request, e))
case e: com.twitter.finagle.IndividualRequestTimeoutException =>
Some(new SttpClientException.ReadException(request, e))
Some(new SttpClientException.TimeoutException(request, e))
Copy link
Member

Choose a reason for hiding this comment

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

@Pask423 there are also individual adapters for Akka and Armeria in this PR. Other backends probably just emit standard java timeout exceptions.

@adamw adamw merged commit ac041be into master Nov 17, 2022
@adamw
Copy link
Member

adamw commented Nov 17, 2022

Thanks!

@mergify mergify bot deleted the timeout_exception branch November 17, 2022 10:42
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.

Add TimeoutException as a subtype of ReadException
4 participants