akka/akka-http

UnexpectedConnectionClosureException cannot be caught since it's in private class

Open

#768 opened on Jan 14, 2017

View on GitHub
 (16 comments) (8 reactions) (0 assignees)Scala (598 forks)batch import
1 - triageddiscusshelp wanted

Repository metrics

Stars
 (1,311 stars)
PR merge metrics
 (Avg merge 1d 10h) (2 merged PRs in 30d)

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