UnexpectedConnectionClosureException cannot be caught since it's in private class
- Dominant language
- Scala
- Stars
- 1.4k
- Forks
- 584
- Avg merge
- 14h 33m
- Merged PRs (30d)
- 24
Description
Akka HTTP version 10.0.1
Somehow we have received a
```
Caused by: akka.http.impl.engine.client.OutgoingConnectionBlueprint$UnexpectedConnectionClosureException: The http server closed the connection unexpectedly before delivering responses for 1 outstanding requests
at akka.http.impl.engine.client.OutgoingConnectionBlueprint$$anonfun$apply$2.apply(OutgoingConnectionBlueprint.scala:127)
at akka.http.impl.engine.client.OutgoingConnectionBlueprint$$anonfun$apply$2.apply(OutgoingConnectionBlueprint.scala:127)
at akka.http.impl.util.One2OneBidiFlow$One2OneBidi$$anon$1$$anon$4.onUpstreamFinish(One2OneBidiFlow.scala:95)
at akka.stream.impl.fusing.GraphInterpreter.processEvent(GraphInterpreter.scala:732)
at akka.stream.impl.fusing.GraphInterpreter.execute(GraphInterpreter.scala:616)
```
But we should beable to `.recover` the future right? So i thought so let's retry the request if that happens:
```
.recoverWith {
// The http server closed the connection unexpectedly before delivering responses
case e: UnexpectedConnectionClosureException if retries > 0 =>
logger.warn(s"Unexpected connection closure, retries left: $retries", e)
//Retry the request with 1 less retry
executeRequest(request, retries - 1)
```
But i'm not allowed to get to the exception since it's inside a private class.
```
Error:(5, 37) object OutgoingConnectionBlueprint in package client cannot be accessed in package akka.http.impl.engine.client
import akka.http.impl.engine.client.OutgoingConnectionBlueprint.UnexpectedConnectionClosureException
```
**Request**: make sure that all exception that can be thrown outside to the system are part of the public API.
Contributor guide
Research direction
Start with akka-http 10.0.1 and akka.http.impl.engine.client.OutgoingConnectionBlueprint.scala, especially the UnexpectedConnectionClosureException shown in the stack trace. Check how the exception is exposed to callers and verify that a client can import and catch it in a recover block; done means externally thrown exceptions are part of the public API.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100