I tried this code:
implicit val customServerOptions: AkkaHttpServerOptions =
AkkaHttpServerOptions.customiseInterceptors
.decodeFailureHandler(ctx => {
logger.error(s"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
ctx.failingInput match {
// when defining how a decode failure should be handled, we need
// to describe the output to be used, and
// a value for this output
case _: EndpointIO.Body[_, _] =>
// see this function and then to failureSourceMessage function
// to find out which types of decode errors are present
val failureMessage = FailureMessages.failureMessage(ctx)
logger.error(s"$failureMessage")
// warning - log working incorrect when there are several endpoints
// with different methods
DefaultDecodeFailureHandler.default(ctx)
case _ =>
logger.error("##########################")
DefaultDecodeFailureHandler.default(ctx)
}
})
.exceptionHandler(ExceptionHandler[Future] { ctx =>
logger.error("##########################################")
// defining exception id for the exception to make search in logs easier.
val exceptionId = UUID.randomUUID()
logger.error(s"Intercepted exception ${ctx.e} while processing request, " +
"exception id: $exceptionId")
Future.successful(Some(ValuedEndpointOutput[ErrorMessage](jsonBody[ErrorMessage],
ErrorMessage(s"Internal Server Error, exception id: $exceptionId"))))
})
.options
// converting an endpoint to a route (providing server-side logic); extension method comes from imported packages
val tapirRoutes: akka.http.scaladsl.server.Route =
AkkaHttpServerInterpreter(customServerOptions)
Doesn´t show anything else,
What else can I do ?