alamb commented on code in PR #11881:
URL: https://github.com/apache/arrow-rs/pull/11881#discussion_r4392097667
##########
arrow-buffer/src/buffer/immutable.rs:
##########
@@ -296,19 +296,31 @@ impl Buffer {
/// # Panics
/// Panics iff `(offset + length)` is larger than the existing length.
pub fn slice_with_length(&self, offset: usize, length: usize) -> Self {
- assert!(
- offset.saturating_add(length) <= self.length,
- "the offset of the new Buffer cannot exceed the existing length:
slice offset={offset} length={length} selflen={}",
- self.length
- );
+ self.try_slice_with_length(offset, length)
+ .unwrap_or_else(|e| panic!("{e}"))
Review Comment:
this is fine - I was just thinking wrap or expect are more standard in the
library
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]