Skip to content

Commit c518f75

Browse files
Apply suggestions from code review
Co-authored-by: Honza Dvorsky <[email protected]>
1 parent a6f7323 commit c518f75

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Sources/OpenAPIRuntime/Interface/ErrorHandlingMiddleware.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ public struct ErrorHandlingMiddleware: ServerMiddleware {
5757
next: @Sendable (HTTPTypes.HTTPRequest, OpenAPIRuntime.HTTPBody?, OpenAPIRuntime.ServerRequestMetadata)
5858
async throws -> (HTTPTypes.HTTPResponse, OpenAPIRuntime.HTTPBody?)
5959
) async throws -> (HTTPTypes.HTTPResponse, OpenAPIRuntime.HTTPBody?) {
60-
do { return try await next(request, body, metadata) } catch let error as ServerError {
61-
if let appError = error.underlyingError as? (any HTTPResponseConvertible) {
60+
do { return try await next(request, body, metadata) } catch {
61+
if let serverError = error as? ServerError, let appError = serverError.underlyingError as? (any HTTPResponseConvertible) {
6262
return (
6363
HTTPResponse(status: appError.httpStatus, headerFields: appError.httpHeaderFields),
6464
appError.httpBody

0 commit comments

Comments
 (0)