Skip to content

Commit

Permalink
Provide trailingMetadata for streaming response error
Browse files Browse the repository at this point in the history
  • Loading branch information
WendellXY committed Aug 23, 2023
1 parent 279170a commit adb8f8d
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,15 @@ public struct GRPCAsyncClientStreamingCall<Request: Sendable, Response: Sendable
/// The response returned by the server.
public var response: Response {
get async throws {
try await self.responseParts.response.get()
do {
return try await self.responseParts.response.get()
} catch {
if let grpcStatus = error as? GRPCStatus {
throw GRPCAsyncError(status: grpcStatus, trailers: try? await self.trailingMetadata)
} else {
throw error
}
}
}
}

Expand Down

0 comments on commit adb8f8d

Please sign in to comment.