Skip to content

Commit 4a58993

Browse files
committed
error
Signed-off-by: Robert Kruszewski <github@robertk.io>
1 parent 35b685c commit 4a58993

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

‎encodings/onpair/src/canonical.rs‎

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,8 @@ use vortex_array::match_each_integer_ptype;
2424
use vortex_buffer::Buffer;
2525
use vortex_buffer::ByteBuffer;
2626
use vortex_buffer::ByteBufferMut;
27-
use vortex_error::VortexResult;
2827
use vortex_error::vortex_ensure;
29-
use vortex_error::vortex_err;
30-
use vortex_error::vortex_panic;
28+
use vortex_error::{VortexResult, vortex_bail};
3129

3230
use crate::OnPair;
3331
use crate::OnPairArraySlotsExt;
@@ -121,15 +119,15 @@ impl<'a> OnPairDecodePlan<'a> {
121119
let written = match onpair::try_decode_into(self.codes.as_slice(), self.dict, out) {
122120
Ok(written) => written,
123121
Err(_) => {
124-
vortex_panic!("OnPair codes decode to more bytes than uncompressed_lengths records")
122+
vortex_bail!("OnPair codes decode to more bytes than uncompressed_lengths records")
125123
}
126124
};
127-
if written != self.total_size {
128-
vortex_panic!(
129-
"OnPair codes decoded to {written} bytes but uncompressed_lengths records {}",
130-
self.total_size
131-
);
132-
}
125+
126+
vortex_ensure!(
127+
written == self.total_size,
128+
"OnPair codes decoded to {written} bytes but uncompressed_lengths records {}",
129+
self.total_size
130+
);
133131
Ok(written)
134132
}
135133
}

0 commit comments

Comments
 (0)