1
0
mirror of https://github.com/facebookincubator/mvfst.git synced 2025-11-24 04:01:07 +03:00

Elevate exceptions out of writeStreamFrameHeader

Summary: Return an error and throw in callers instead.

Reviewed By: sharmafb

Differential Revision: D70011330

fbshipit-source-id: 9dc16d0f67ac13c58c3d89132d3bdc0c99e0cdd9
This commit is contained in:
Konstantin Tsoy
2025-02-25 09:02:01 -08:00
committed by Facebook GitHub Bot
parent 71b4e1c613
commit 7ba66a2d77
10 changed files with 118 additions and 42 deletions

View File

@@ -28,7 +28,7 @@ bool packetSpaceCheck(uint64_t limit, size_t require) {
namespace quic {
Optional<uint64_t> writeStreamFrameHeader(
folly::Expected<Optional<uint64_t>, QuicError> writeStreamFrameHeader(
PacketBuilderInterface& builder,
StreamId id,
uint64_t offset,
@@ -42,9 +42,9 @@ Optional<uint64_t> writeStreamFrameHeader(
return none;
}
if (writeBufferLen == 0 && !fin) {
throw QuicInternalException(
"No data or fin supplied when writing stream.",
LocalErrorCode::INTERNAL_ERROR);
return folly::makeUnexpected(QuicError(
LocalErrorCode::INTERNAL_ERROR,
"No data or fin supplied when writing stream."));
}
StreamTypeField::Builder streamTypeBuilder;
if (streamGroupId) {