Skip to content

Commit

Permalink
Merge pull request #577 from danicheg/fix-#574
Browse files Browse the repository at this point in the history
Add the ability to change the default service error handling on the server
  • Loading branch information
danicheg authored Dec 8, 2024
2 parents c58d306 + 3d722b7 commit 57b0a8c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down

0 comments on commit 57b0a8c

Please sign in to comment.