Class
ErrorMiddleware
Captures all errors and transforms them into an internal server error HTTP response.
final class ErrorMiddleware
Topics
Initializers
init(@Sendable (Request, any Error) -> (Response))Create a newErrorMiddleware.
Instance Methods
Type Methods
static func `default`(environment: Environment) -> ErrorMiddlewareCreate a defaultErrorMiddleware. Logs each error at itsDebuggableError/logLevel, or.debugfor an error that isn’t aDebuggableError, and convertsErrortoResponsebased onEnvironmentand on conformance toAbortErrorandDebuggable.
Relationships
Conforms To
MiddlewareSwift.SendableSwift.SendableMetatype