Skip to content

Commit

Permalink
Make sure the onCompleted() callback is always invoked in the error c…
Browse files Browse the repository at this point in the history
…ase even if trying to write the error indication to the stream fails
  • Loading branch information
gwynne committed May 1, 2024
1 parent 907f616 commit f2988e4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/Vapor/Utilities/FileIO.swift
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ public struct FileIO: Sendable {
try await stream.write(.end)
try await onCompleted(.success(()))
} catch {
try await stream.write(.error(error))
try? await stream.write(.error(error))
try await onCompleted(.failure(error))
}
}, count: byteCount, byteBufferAllocator: request.byteBufferAllocator)
Expand Down

0 comments on commit f2988e4

Please sign in to comment.