diff options
Diffstat (limited to 'src/zenutil/packageformat.cpp')
| -rw-r--r-- | src/zenutil/packageformat.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
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::function<IoBuffer(const IoHash&, uint if (Hdr.HeaderMagic != kCbPkgMagic) { - throw std::runtime_error("invalid CbPackage header magic"); + throw std::invalid_argument("invalid CbPackage header magic"); } const uint32_t ChunkCount = Hdr.AttachmentCount + 1; @@ -455,11 +455,11 @@ ParsePackageMessage(IoBuffer Payload, std::function<IoBuffer(const IoHash&, uint CompressedBuffer CompBuf(CompressedBuffer::FromCompressedNoValidate(std::move(ChunkReference))); if (!CompBuf) { - throw std::runtime_error(fmt::format("invalid format for chunk #{} at '{}' (offset {}, size {})", - i, - Path, - AttachRefHdr->PayloadByteOffset, - 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<IoBuffer(const IoHash&, uint CompressedBuffer CompBuf(CompressedBuffer::FromCompressedNoValidate(IoBuffer(AttachmentBuffer))); if (!CompBuf) { - throw std::runtime_error(fmt::format("invalid format for chunk #{} expected compressed buffer for CbObject", i)); + throw std::invalid_argument(fmt::format("invalid format for chunk #{} expected compressed buffer for CbObject", i)); } // First payload is always a compact binary object Package.SetObject(LoadCompactBinaryObject(std::move(CompBuf))); @@ -487,7 +487,7 @@ ParsePackageMessage(IoBuffer Payload, std::function<IoBuffer(const IoHash&, uint CompressedBuffer CompBuf(CompressedBuffer::FromCompressedNoValidate(IoBuffer(AttachmentBuffer))); if (!CompBuf) { - throw std::runtime_error(fmt::format("invalid format for chunk #{} expected compressed buffer for attachment", i)); + throw std::invalid_argument(fmt::format("invalid format for chunk #{} expected compressed buffer for attachment", i)); } Attachments.emplace_back(CbAttachment(std::move(CompBuf), Entry.AttachmentHash)); } |