From 79c44e3223c2bb9c6c49ccefa9cae71f1f2af336 Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Mon, 5 Feb 2024 12:29:43 +0100 Subject: respond with BadRequest result instead of throwing exception on bad request input (#648) --- src/zenutil/packageformat.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/zenutil/packageformat.cpp') diff --git a/src/zenutil/packageformat.cpp b/src/zenutil/packageformat.cpp index 015782283..7c284a4e6 100644 --- a/src/zenutil/packageformat.cpp +++ b/src/zenutil/packageformat.cpp @@ -362,7 +362,7 @@ ParsePackageMessage(IoBuffer Payload, std::functionPayloadByteOffset, - AttachRefHdr->PayloadByteSize)); + throw std::invalid_argument(fmt::format("invalid format for chunk #{} at '{}' (offset {}, size {})", + i, + Path, + AttachRefHdr->PayloadByteOffset, + AttachRefHdr->PayloadByteSize)); } Attachments.emplace_back(CbAttachment(std::move(CompBuf), Entry.AttachmentHash)); } @@ -472,7 +472,7 @@ ParsePackageMessage(IoBuffer Payload, std::function