From 484b778eb28f3569662339247b0922f4caacef7b Mon Sep 17 00:00:00 2001 From: danicheg Date: Sat, 7 Dec 2024 14:13:59 +0300 Subject: [PATCH 1/2] Add a new constructor for ArmeriaHttp4sHandler and deprecate a former one --- .../armeria/server/ArmeriaHttp4sHandler.scala | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/server/src/main/scala/org/http4s/armeria/server/ArmeriaHttp4sHandler.scala b/server/src/main/scala/org/http4s/armeria/server/ArmeriaHttp4sHandler.scala index be29b40..9277909 100644 --- a/server/src/main/scala/org/http4s/armeria/server/ArmeriaHttp4sHandler.scala +++ b/server/src/main/scala/org/http4s/armeria/server/ArmeriaHttp4sHandler.scala @@ -247,7 +247,19 @@ private[armeria] object ArmeriaHttp4sHandler { def apply[F[_]: Async]( prefix: String, service: HttpApp[F], - dispatcher: Dispatcher[F]): ArmeriaHttp4sHandler[F] = + serviceErrorHandler: ServiceErrorHandler[F], + dispatcher: Dispatcher[F] + ): ArmeriaHttp4sHandler[F] = + new ArmeriaHttp4sHandler(prefix, service, serviceErrorHandler, dispatcher) + + @deprecated( + "Use fully specified `org.http4s.armeria.server.ArmeriaHttp4sHandler.apply` instead", + "0.5.5") + def apply[F[_]: Async]( + prefix: String, + service: HttpApp[F], + dispatcher: Dispatcher[F] + ): ArmeriaHttp4sHandler[F] = new ArmeriaHttp4sHandler(prefix, service, DefaultServiceErrorHandler, dispatcher) private val serverSoftware: ServerSoftware = From 3d722b7b8eb4682472fffe352c78bed0a513ccfe Mon Sep 17 00:00:00 2001 From: danicheg Date: Sat, 7 Dec 2024 14:15:02 +0300 Subject: [PATCH 2/2] Tweak the ArmeriaServerBuilder#withHttpApp --- .../org/http4s/armeria/server/ArmeriaServerBuilder.scala | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/src/main/scala/org/http4s/armeria/server/ArmeriaServerBuilder.scala b/server/src/main/scala/org/http4s/armeria/server/ArmeriaServerBuilder.scala index 7201ad5..71dd56d 100644 --- a/server/src/main/scala/org/http4s/armeria/server/ArmeriaServerBuilder.scala +++ b/server/src/main/scala/org/http4s/armeria/server/ArmeriaServerBuilder.scala @@ -158,7 +158,9 @@ sealed class ArmeriaServerBuilder[F[_]] private ( def withHttpApp(prefix: String, service: HttpApp[F]): Self = copy(addServices = (ab, dispatcher) => addServices(ab, dispatcher).map( - _.serviceUnder(prefix, ArmeriaHttp4sHandler(prefix, service, dispatcher)))) + _.serviceUnder( + prefix, + ArmeriaHttp4sHandler(prefix, service, serviceErrorHandler, dispatcher)))) /** Decorates all HTTP services with the specified [[DecoratingFunction]]. */ def withDecorator(decorator: DecoratingFunction): Self =