akka/akka-http

UnexpectedConnectionClosureException cannot be caught since it's in private class

オープン

#768 opened on 2017/01/14

 (16 件のコメント) (8 件のリアクション) (0 人の担当者)Scala (598 件のフォーク)batch import
1 - triageddiscusshelp wanted

Repository metrics

Stars
 (1,311 個のスター)
PR merge metrics
 (平均マージ 1d 10h) (30d で 2 merged PRs)

説明

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.

コントリビューターガイド