Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to change the default service error handling on the server #577

Merged
merged 2 commits into from
Dec 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading