Skip to content

Commit c671f57

Browse files
author
Gayathri Sairamkrishnan
committed
Update error handling middleware name
1 parent 76d31c6 commit c671f57

File tree

1 file changed

+4
-2
lines changed
  • Sources/swift-openapi-generator/Documentation.docc/Proposals

1 file changed

+4
-2
lines changed

Sources/swift-openapi-generator/Documentation.docc/Proposals/SOAR-0011.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,10 @@ extension HTTPResponseConvertible {
8787
#### Proposed Error Middleware
8888

8989
The 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
133135
let handler = try await RequestHandler()
134-
try handler.registerHandlers(on: transport, middlewares: [ErrorMiddleware()])
136+
try handler.registerHandlers(on: transport, middlewares: [ErrorHandlingMiddleware()])
135137

136138
```
137139

0 commit comments

Comments
 (0)