diff --git a/ledger-service/http-json/src/main/scala/com/digitalasset/http/Endpoints.scala b/ledger-service/http-json/src/main/scala/com/digitalasset/http/Endpoints.scala index c6cdd87977b0..26fa0bb6fe54 100644 --- a/ledger-service/http-json/src/main/scala/com/digitalasset/http/Endpoints.scala +++ b/ledger-service/http-json/src/main/scala/com/digitalasset/http/Endpoints.scala @@ -322,7 +322,9 @@ class Endpoints( output.map(_.fold(httpResponseError, searchHttpResponse)) } - private def searchHttpResponse(searchResult: SearchResult[Error \/ JsValue]): HttpResponse = { + private def searchHttpResponse( + searchResult: SearchResult[Error \/ JsValue] + )(implicit lc: LoggingContextOf[RequestID]): HttpResponse = { import json.JsonProtocol._ val response: Source[ByteString, NotUsed] = searchResult match { @@ -341,9 +343,17 @@ class Endpoints( ) } - private[this] def filterStreamErrors[E, A]: Flow[Error \/ A, Error \/ A, NotUsed] = + private[this] def filterStreamErrors[A](implicit + lc: LoggingContextOf[RequestID] + ): Flow[Error \/ A, Error \/ A, NotUsed] = Flow[Error \/ A].map { - case -\/(ServerError(_)) => -\/(ServerError.fromMsg("internal server error")) + case -\/(ServerError(t)) => + val hideMsg = "internal server error" + logger.error( + s"hiding internal error details from response, responding '$hideMsg' instead", + t, + ) + -\/(ServerError.fromMsg(hideMsg)) case o => o }