Skip to content

Commit

Permalink
MOD: Improve RecordRef::get panic message
Browse files Browse the repository at this point in the history
  • Loading branch information
threecgreen committed Jan 8, 2024
1 parent aede39b commit 9444242
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
- Added Python type definition for `Metadata.__init__`
- Added `metadata_mut` method to decoders to get a mutable reference to the decoded
metadata
- Improved panic message on `RecordRef::get` when length doesn't match expected to be
actionable
- Added `encode::ZSTD_COMPRESSION_LEVEL` constant

### Breaking changes
Expand Down
4 changes: 3 additions & 1 deletion rust/dbn/src/record_ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ impl<'a> RecordRef<'a> {
if self.has::<T>() {
assert!(
self.record_size() >= mem::size_of::<T>(),
"Malformed record. Expected length of at least {} bytes, found {} bytes",
"Malformed `{}` record: expected length of at least {} bytes, found {} bytes. \
Confirm the DBN version in the Metadata header and the version upgrade policy",
std::any::type_name::<T>(),
mem::size_of::<T>(),
self.record_size()
);
Expand Down

0 comments on commit 9444242

Please sign in to comment.