File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
Sources/swift-openapi-generator/Documentation.docc/Proposals Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -87,8 +87,10 @@ extension HTTPResponseConvertible {
8787#### Proposed Error Middleware
8888
8989The proposed error middleware in OpenAPIRuntime will convert the application error to the appropriate error response.
90+ It returns 500 for application error(s) that do not conform to HTTPResponseConvertible protocol.
91+
9092``` swift
91- public struct ErrorMiddleware : ServerMiddleware {
93+ public struct ErrorHandlingMiddleware : ServerMiddleware {
9294 func intercept (_ request : HTTPTypes.HTTPRequest,
9395 body : OpenAPIRuntime.HTTPBody? ,
9496 metadata : OpenAPIRuntime.ServerRequestMetadata,
@@ -131,7 +133,7 @@ extension MyAppError: HTTPResponseConvertible {
131133
132134``` swift
133135let handler = try await RequestHandler ()
134- try handler.registerHandlers (on : transport, middlewares : [ErrorMiddleware ()])
136+ try handler.registerHandlers (on : transport, middlewares : [ErrorHandlingMiddleware ()])
135137
136138```
137139
You can’t perform that action at this time.
0 commit comments