Class
ErrorMiddleware
Captures all errors and transforms them into an internal server error HTTP response.
final class ErrorMiddleware
Topics
Initializers
init((Request, any Error) -> Response)Create a newErrorMiddleware.
Instance Methods
func respond(to: Request, chainingTo: any Responder) -> EventLoopFuture<Response>Called with eachRequestthat passes through this middleware.
Type Methods
static func `default`(environment: Environment) -> ErrorMiddlewareCreate a defaultErrorMiddleware. Logs errors to aLoggerbased onEnvironmentand convertsErrortoResponsebased on conformance toAbortErrorandDebuggable.
Relationships
Conforms To
MiddlewareSwift.SendableSwift.SendableMetatype