Skip to content

Commit 2ee2c82

Browse files
robert3005claude
andcommitted
Replace VortexError's variants with a kind, and give every error one
VortexError carried one enum variant per dependency that could fail (Arrow, FlatBuffers, ObjectStore, Jiff, Tokio, TryFromInt, Prost, Fmt) plus two structural wrappers (Context, Shared). None were constructed by name outside the `From` impls or matched on, and the only classification callers could act on, the `vx_error_code` the C API exports, reported OTHER for nearly everything: 1966 `vortex_err!` sites and all 1133 `vortex_ensure!` and `vortex_panic!` sites gave no kind at all. It was the equivalent of a codebase that only ever raises bare `Exception`. The error type VortexError is now a struct holding a `VortexErrorKind`, a message, an optional source and a backtrace, `Arc`-backed so it is cheaply `Clone`. Errors from dependencies are classified by what they mean to Vortex and kept as `Error::source`, where callers downcast. `Context` becomes a message prefix that preserves kind, source and backtrace; `Shared` goes away. `size_of::<VortexError>()` drops from 88 bytes to 56, and the `?` conversion path no longer formats eagerly. The kinds are the C API's existing codes with two additions and one removal: - NotFound, for a name lookup that found nothing: a missing field, an unknown encoding id, an absent segment. Python raises KeyError here. - Overflow, for a numeric value that will not fit its target, the largest group that was hiding in Other. `From<TryFromIntError>` produces it, so `?` on a `try_from` classifies itself. - Compute is removed. Every other kind names what went wrong; Compute named where it happened, which the enum's own docs say a kind must not do. Its 11 sites were all Overflow, MismatchedTypes or Serde. NotFound and Overflow take C codes 10 and 11; Compute's slot 2 is retired and not reused, so no existing code moves. cbindgen regenerated cinclude/vortex.h and the hand-written C++ mirror in lang/cpp matches. The macros `vortex_err!`, `vortex_bail!`, `vortex_ensure!`, `vortex_ensure_eq!` and `vortex_panic!` now require a leading `Kind:` before any message; the untagged arm is replaced by a compile error naming the fix, with compile_fail doctests keeping it that way. The three canned arms (`MismatchedTypes: expected, actual` and the like) are gone: a literal is an expr, so `vortex_bail!(MismatchedTypes: "Expected {:?}", x)` matched the canned arm and rendered its braces verbatim. The 32 sites that used them spell their message out. The macros no longer inject `use std::backtrace::Backtrace;` into caller scope. `vortex_ensure_eq!(a, b)` with no message still reports AssertionFailed, showing both expressions and values. A check on the caller's input names its kind alone, `vortex_ensure_eq!(a, b, InvalidArgument)`, and keeps that output. The sites Every construction site now names its kind, each chosen by reading the site. The rules that settle the ambiguous ones: a check on what the caller passed in is InvalidArgument or MismatchedTypes, and a length mismatch is never a type error; a check that a kernel, rewrite or executor kept its own contract is AssertionFailed; a check made while decoding metadata or a wire format is Serde; a child index nobody can satisfy is OutOfBounds however it is phrased. Io covers operating-system and device-driver calls, so the CUDA, nvcomp and CUB status failures are Io, as Python's OSError would be. The sites left Other carry it explicitly, so each reads as a decision. `From<ArrowError>` sent every Arrow failure to Other; each variant now maps to its kind (ArithmeticOverflow to Overflow, SchemaError to MismatchedTypes, the file-format variants to Serde, and so on). `From<jiff::Error>` maps a date that does not exist or a misused unit to InvalidArgument. pco's Corruption and InsufficientData map to Serde. 44 sites wrapped an inner VortexError in a fresh `vortex_err!`, which replaced its kind with a guess and nested its whole Display, backtrace included, in the new message. A text scan cannot tell those from the same shape around an io::Error, so a throwaway build probed every `map_err` closure with a marker type whose must_use warning fires only for a VortexError. The 29 that wrapped edition-registration calls lose the `map_err`; the rest use `with_context`, or the `vortex_panic!(err, "...")` form, which keep the kind. STYLE.md now says to do that. Python The Python bindings turned every VortexError into RuntimeError, so none of this reached Python. Each kind now raises its analogue: OutOfBounds IndexError NotFound KeyError Overflow OverflowError InvalidArgument ValueError Serde ValueError MismatchedTypes TypeError NotImplemented NotImplementedError AssertionFailed AssertionError Io OSError Other RuntimeError Signed-off-by: Robert Kruszewski <github@robertk.io> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S7EtMqoZ91rrCCh9vS2yTm
1 parent c6e51ba commit 2ee2c82

714 files changed

Lines changed: 4831 additions & 4292 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎STYLE.md‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,20 @@
5454
- `vortex_panic!` for handling invariant violations
5555
- `vortex_ensure!` and `vortex_ensure_eq!` for checking conditions. Prefer
5656
`vortex_ensure_eq!(a, b)` with no message: the error already shows both expressions and values.
57-
Add a message only for context the expressions lack, and never repeat the values in it.
58-
- Add context to errors using `.with_context()`
57+
Add a message only for context the expressions lack, and never repeat the values in it. With no
58+
message the error is `AssertionFailed`; when the check is on the caller's input rather than an
59+
internal invariant, name the kind alone, as in `vortex_ensure_eq!(a, b, InvalidArgument)`.
60+
- Every message names its `VortexErrorKind`, as in `vortex_bail!(InvalidArgument: "...")`; the
61+
macros reject a message without one. Choose the kind by what went wrong, the way Python picks an
62+
exception class: `InvalidArgument` (`ValueError`) for a value the callee rejects,
63+
`MismatchedTypes` (`TypeError`) for the wrong dtype, `OutOfBounds` (`IndexError`) for a position
64+
past the end, `NotFound` (`KeyError`) for a name that resolves to nothing, `Overflow`
65+
(`OverflowError`) for a value that does not fit its target, `NotImplemented`, `Serde` for an
66+
unreadable wire or file format, `Io` for a failed system or driver call, `AssertionFailed` for a
67+
broken internal invariant, and `Other` only when nothing else fits. Never classify by where the
68+
failure happened.
69+
- Add context to an existing error with `.with_context()`, which keeps its kind; do not format it
70+
into a new `vortex_err!`, which discards the kind.
5971
- Include backtraces for better debugging
6072
- Use `VortexExpect` trait when unwrapping is appropriate with proper error context.
6173

‎encodings/alp/src/alp/array.rs‎

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl VTable for ALP {
9797
}
9898

9999
fn buffer(_array: ArrayView<'_, Self>, idx: usize) -> BufferHandle {
100-
vortex_panic!("ALPArray buffer index {idx} out of bounds")
100+
vortex_panic!(OutOfBounds: "ALPArray buffer index {idx} out of bounds")
101101
}
102102

103103
fn buffer_name(_array: ArrayView<'_, Self>, _idx: usize) -> Option<String> {
@@ -143,7 +143,7 @@ impl VTable for ALP {
143143
let encoded_ptype = match &dtype {
144144
DType::Primitive(PType::F32, n) => DType::Primitive(PType::I32, *n),
145145
DType::Primitive(PType::F64, n) => DType::Primitive(PType::I64, *n),
146-
d => vortex_bail!(MismatchedTypes: "f32 or f64", d),
146+
d => vortex_bail!(MismatchedTypes: "expected type: f32 or f64 but instead got {}", d),
147147
};
148148
let encoded = children.get(0, &encoded_ptype, len)?;
149149

@@ -267,7 +267,7 @@ impl ALPData {
267267
encoded.dtype(),
268268
DType::Primitive(PType::I32 | PType::I64, _)
269269
),
270-
"ALP encoded ints have invalid DType {}",
270+
MismatchedTypes: "ALP encoded ints have invalid DType {}",
271271
encoded.dtype(),
272272
);
273273

@@ -276,15 +276,15 @@ impl ALPData {
276276
let Exponents { e, f } = exponents;
277277
match encoded.dtype().as_ptype() {
278278
PType::I32 => {
279-
vortex_ensure!(exponents.e <= f32::MAX_EXPONENT, "e out of bounds: {e}");
280-
vortex_ensure!(exponents.f <= f32::MAX_EXPONENT, "f out of bounds: {f}");
279+
vortex_ensure!(exponents.e <= f32::MAX_EXPONENT, InvalidArgument: "e out of bounds: {e}");
280+
vortex_ensure!(exponents.f <= f32::MAX_EXPONENT, InvalidArgument: "f out of bounds: {f}");
281281
if let Some(patches) = patches {
282282
Self::validate_patches::<f32>(patches, encoded)?;
283283
}
284284
}
285285
PType::I64 => {
286-
vortex_ensure!(e <= f64::MAX_EXPONENT, "e out of bounds: {e}");
287-
vortex_ensure!(f <= f64::MAX_EXPONENT, "f out of bounds: {f}");
286+
vortex_ensure!(e <= f64::MAX_EXPONENT, InvalidArgument: "e out of bounds: {e}");
287+
vortex_ensure!(f <= f64::MAX_EXPONENT, InvalidArgument: "f out of bounds: {f}");
288288

289289
if let Some(patches) = patches {
290290
Self::validate_patches::<f64>(patches, encoded)?;
@@ -295,7 +295,7 @@ impl ALPData {
295295

296296
// Validate patches
297297
if let Some(patches) = patches {
298-
vortex_ensure_eq!(patches.array_len(), encoded.len());
298+
vortex_ensure_eq!(patches.array_len(), encoded.len(), InvalidArgument);
299299

300300
// Verify that the patches DType are of the proper DType.
301301
}
@@ -311,7 +311,9 @@ impl ALPData {
311311
DType::Primitive(PType::I64, nullability) => {
312312
Ok(DType::Primitive(PType::F64, *nullability))
313313
}
314-
_ => vortex_bail!("ALP encoded ints have invalid DType {}", encoded.dtype(),),
314+
_ => {
315+
vortex_bail!(MismatchedTypes: "ALP encoded ints have invalid DType {}", encoded.dtype(),)
316+
}
315317
}
316318
}
317319

@@ -320,10 +322,10 @@ impl ALPData {
320322
patches: &Patches,
321323
encoded: &ArrayRef,
322324
) -> VortexResult<()> {
323-
vortex_ensure_eq!(patches.array_len(), encoded.len());
325+
vortex_ensure_eq!(patches.array_len(), encoded.len(), InvalidArgument);
324326

325327
let expected_type = DType::Primitive(T::PTYPE, encoded.dtype().nullability());
326-
vortex_ensure_eq!(patches.dtype(), &expected_type);
328+
vortex_ensure_eq!(patches.dtype(), &expected_type, MismatchedTypes);
327329

328330
Ok(())
329331
}
@@ -437,11 +439,11 @@ fn validate_parts(
437439
) -> VortexResult<()> {
438440
let logical_dtype = ALPData::logical_dtype(encoded)?;
439441
ALPData::validate_components(encoded, exponents, patches.as_ref())?;
440-
vortex_ensure_eq!(encoded.len(), len, "ALP encoded len must match outer len");
442+
vortex_ensure_eq!(encoded.len(), len, InvalidArgument: "ALP encoded len must match outer len");
441443
vortex_ensure_eq!(
442444
&logical_dtype,
443445
dtype,
444-
"ALP dtype does not match encoded logical dtype"
446+
MismatchedTypes: "ALP dtype does not match encoded logical dtype"
445447
);
446448
Ok(())
447449
}

‎encodings/alp/src/alp/compress.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ macro_rules! match_each_alp_float_ptype {
3939
type $enc = f64;
4040
$body
4141
}
42-
_ => vortex_panic!("ALP can only encode f32 and f64, got {}", ptype),
42+
_ => vortex_panic!(MismatchedTypes: "ALP can only encode f32 and f64, got {}", ptype),
4343
}
4444
}};
4545
}
@@ -52,7 +52,7 @@ pub fn alp_encode(
5252
let (exponents, encoded, patches) = match parray.ptype() {
5353
PType::F32 => alp_encode_components_typed::<f32>(parray, exponents, ctx)?,
5454
PType::F64 => alp_encode_components_typed::<f64>(parray, exponents, ctx)?,
55-
_ => vortex_bail!("ALP can only encode f32 and f64"),
55+
_ => vortex_bail!(MismatchedTypes: "ALP can only encode f32 and f64"),
5656
};
5757

5858
// SAFETY: alp_encode_components_typed must return well-formed components

‎encodings/alp/src/alp/compute/compare.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ impl CompareKernel for ALP {
4545
if let Some(const_scalar) = rhs.as_constant() {
4646
let pscalar = const_scalar.as_primitive_opt().ok_or_else(|| {
4747
vortex_err!(
48-
"ALP Compare RHS had the wrong type {}, expected {}",
48+
InvalidArgument: "ALP Compare RHS had the wrong type {}, expected {}",
4949
const_scalar,
5050
const_scalar.dtype()
5151
)
@@ -55,7 +55,7 @@ impl CompareKernel for ALP {
5555
match pscalar.typed_value::<T>() {
5656
Some(value) => return alp_scalar_compare(lhs, value, operator),
5757
None => vortex_bail!(
58-
"Failed to convert scalar {:?} to ALP type {:?}",
58+
InvalidArgument: "Failed to convert scalar {:?} to ALP type {:?}",
5959
pscalar,
6060
pscalar.ptype()
6161
),

‎encodings/alp/src/alp/ops.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl OperationsVTable<ALP> for ALP {
3636

3737
let encoded_val = state
3838
.slot(ALPSlots::ENCODED)?
39-
.ok_or_else(|| vortex_err!("ALP encoded slot is missing"))?
39+
.ok_or_else(|| vortex_err!(InvalidArgument: "ALP encoded slot is missing"))?
4040
.execute_scalar(index, ctx)?;
4141

4242
Ok(match_each_alp_float_ptype!(array.dtype().as_ptype(), |T| {

‎encodings/alp/src/alp/plugin.rs‎

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl ArrayPlugin for ALPPatchedPlugin {
5555
vortex_ensure_eq!(
5656
parts.serialized_id,
5757
self.id(),
58-
"ALP plugin does not recognize serialized ID"
58+
Serde: "ALP plugin does not recognize serialized ID"
5959
);
6060
let alp_array = Array::<ALP>::try_from_parts(ArrayVTable::deserialize(
6161
&ALP,
@@ -66,7 +66,7 @@ impl ArrayPlugin for ALPPatchedPlugin {
6666
parts.children,
6767
session,
6868
)?)
69-
.map_err(|_| vortex_err!("ALP plugin should only deserialize vortex.alp"))?;
69+
.map_err(|_| vortex_err!(Serde: "ALP plugin should only deserialize vortex.alp"))?;
7070

7171
// Check if there are interior patches to externalize.
7272
let Some(patches) = alp_array.patches() else {
@@ -161,15 +161,13 @@ mod tests {
161161
&SESSION,
162162
)?;
163163

164-
let patched: PatchedArray = deserialized
165-
.try_downcast()
166-
.map_err(|a| vortex_err!("Expected Patched, got {}", a.encoding_id()))?;
164+
let patched: PatchedArray = deserialized.try_downcast().map_err(
165+
|a| vortex_err!(MismatchedTypes: "Expected Patched, got {}", a.encoding_id()),
166+
)?;
167167

168-
let inner_alp: ALPArray = patched
169-
.inner()
170-
.clone()
171-
.try_downcast()
172-
.map_err(|a| vortex_err!("Expected inner ALP, got {}", a.encoding_id()))?;
168+
let inner_alp: ALPArray = patched.inner().clone().try_downcast().map_err(
169+
|a| vortex_err!(MismatchedTypes: "Expected inner ALP, got {}", a.encoding_id()),
170+
)?;
173171

174172
assert!(
175173
inner_alp.patches().is_none(),
@@ -213,9 +211,9 @@ mod tests {
213211
&SESSION,
214212
)?;
215213

216-
let result = deserialized
217-
.try_downcast::<ALP>()
218-
.map_err(|a| vortex_err!("Expected deserialized ALP, got {}", a.encoding_id()))?;
214+
let result = deserialized.try_downcast::<ALP>().map_err(
215+
|a| vortex_err!(Serde: "Expected deserialized ALP, got {}", a.encoding_id()),
216+
)?;
219217

220218
assert!(result.patches().is_none(), "Result should not have patches");
221219

‎encodings/alp/src/alp_rd/array.rs‎

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ impl VTable for ALPRD {
121121
}
122122

123123
fn buffer(_array: ArrayView<'_, Self>, idx: usize) -> BufferHandle {
124-
vortex_panic!("ALPRDArray buffer index {idx} out of bounds")
124+
vortex_panic!(OutOfBounds: "ALPRDArray buffer index {idx} out of bounds")
125125
}
126126

127127
fn buffer_name(_array: ArrayView<'_, Self>, _idx: usize) -> Option<String> {
@@ -174,7 +174,7 @@ impl VTable for ALPRD {
174174
let metadata = ALPRDMetadata::decode(metadata)?;
175175
if children.len() < 2 {
176176
vortex_bail!(
177-
"Expected at least 2 children for ALPRD encoding, found {}",
177+
InvalidArgument: "Expected at least 2 children for ALPRD encoding, found {}",
178178
children.len()
179179
);
180180
}
@@ -185,8 +185,9 @@ impl VTable for ALPRD {
185185
[0..metadata.dict_len as usize]
186186
.iter()
187187
.map(|&i| {
188-
u16::try_from(i)
189-
.map_err(|_| vortex_err!("left_parts_dictionary code {i} does not fit in u16"))
188+
u16::try_from(i).map_err(
189+
|_| vortex_err!(Overflow: "left_parts_dictionary code {i} does not fit in u16"),
190+
)
190191
})
191192
.try_collect()?;
192193

@@ -197,7 +198,7 @@ impl VTable for ALPRD {
197198
DType::Primitive(PType::F64, _) => {
198199
DType::Primitive(PType::U64, Nullability::NonNullable)
199200
}
200-
_ => vortex_bail!("Expected f32 or f64 dtype, got {:?}", dtype),
201+
_ => vortex_bail!(MismatchedTypes: "Expected f32 or f64 dtype, got {:?}", dtype),
201202
};
202203
let right_parts = children.get(1, &right_parts_dtype, len)?;
203204

@@ -222,7 +223,7 @@ impl VTable for ALPRD {
222223
left_parts_dictionary,
223224
u8::try_from(metadata.right_bit_width).map_err(|_| {
224225
vortex_err!(
225-
"right_bit_width {} out of u8 range",
226+
Overflow: "right_bit_width {} out of u8 range",
226227
metadata.right_bit_width
227228
)
228229
})?,
@@ -476,18 +477,18 @@ fn validate_parts(
476477
left_parts_patches: Option<&Patches>,
477478
) -> VortexResult<()> {
478479
if !dtype.is_float() {
479-
vortex_bail!("ALPRDArray given invalid DType ({dtype})");
480+
vortex_bail!(InvalidArgument: "ALPRDArray given invalid DType ({dtype})");
480481
}
481482

482-
vortex_ensure_eq!(left_parts.len(), len);
483-
vortex_ensure_eq!(right_parts.len(), len);
483+
vortex_ensure_eq!(left_parts.len(), len, InvalidArgument);
484+
vortex_ensure_eq!(right_parts.len(), len, InvalidArgument);
484485

485486
if !left_parts.dtype().is_unsigned_int() {
486-
vortex_bail!("left_parts dtype must be uint");
487+
vortex_bail!(InvalidArgument: "left_parts dtype must be uint");
487488
}
488489
if dtype.is_nullable() != left_parts.dtype().is_nullable() {
489490
vortex_bail!(
490-
"ALPRDArray dtype nullability ({}) must match left_parts dtype nullability ({})",
491+
InvalidArgument: "ALPRDArray dtype nullability ({}) must match left_parts dtype nullability ({})",
491492
dtype,
492493
left_parts.dtype()
493494
);
@@ -496,12 +497,16 @@ fn validate_parts(
496497
let expected_right_parts_dtype = match dtype {
497498
DType::Primitive(PType::F32, _) => DType::Primitive(PType::U32, Nullability::NonNullable),
498499
DType::Primitive(PType::F64, _) => DType::Primitive(PType::U64, Nullability::NonNullable),
499-
_ => vortex_bail!("Expected f32 or f64 dtype, got {:?}", dtype),
500+
_ => vortex_bail!(MismatchedTypes: "Expected f32 or f64 dtype, got {:?}", dtype),
500501
};
501-
vortex_ensure_eq!(right_parts.dtype(), &expected_right_parts_dtype);
502+
vortex_ensure_eq!(
503+
right_parts.dtype(),
504+
&expected_right_parts_dtype,
505+
MismatchedTypes
506+
);
502507

503508
if let Some(patches) = left_parts_patches {
504-
vortex_ensure_eq!(patches.array_len(), len);
509+
vortex_ensure_eq!(patches.array_len(), len, InvalidArgument);
505510
// Left-parts exceptions are always all-valid and are stored as the non-nullable left-parts
506511
// dtype. Requiring that exact dtype (rather than ignoring nullability) means each
507512
// construction path must produce correct patches, removing the need to normalize them.
@@ -510,7 +515,7 @@ fn validate_parts(
510515
vortex_ensure_eq!(
511516
patches.dtype(),
512517
&expected,
513-
"patches dtype must be the non-nullable left_parts dtype"
518+
MismatchedTypes: "patches dtype must be the non-nullable left_parts dtype"
514519
);
515520
}
516521

‎encodings/alp/src/alp_rd/mod.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ where
146146
T::UINT: NativePType,
147147
{
148148
if left_parts.len() != right_parts.len() {
149-
vortex_panic!("alp_rd_decode: left_parts.len != right_parts.len");
149+
vortex_panic!(AssertionFailed: "alp_rd_decode: left_parts.len != right_parts.len");
150150
}
151151

152152
if let Some(patches) = left_parts_patches {

‎encodings/bytebool/src/array.rs‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,14 @@ impl VTable for ByteBool {
8585
fn buffer(array: ArrayView<'_, Self>, idx: usize) -> BufferHandle {
8686
match idx {
8787
0 => array.buffer().clone(),
88-
_ => vortex_panic!("ByteBoolArray buffer index {idx} out of bounds"),
88+
_ => vortex_panic!(OutOfBounds: "ByteBoolArray buffer index {idx} out of bounds"),
8989
}
9090
}
9191

9292
fn buffer_name(_array: ArrayView<'_, Self>, idx: usize) -> Option<String> {
9393
match idx {
9494
0 => Some("values".to_string()),
95-
_ => vortex_panic!("ByteBoolArray buffer_name index {idx} out of bounds"),
95+
_ => vortex_panic!(OutOfBounds: "ByteBoolArray buffer_name index {idx} out of bounds"),
9696
}
9797
}
9898

@@ -101,7 +101,7 @@ impl VTable for ByteBool {
101101
array: ArrayView<'_, Self>,
102102
buffers: &[BufferHandle],
103103
) -> VortexResult<ArrayParts<Self>> {
104-
vortex_ensure_eq!(buffers.len(), 1);
104+
vortex_ensure_eq!(buffers.len(), 1, InvalidArgument);
105105
let data = ByteBoolData::new(buffers[0].clone());
106106
Ok(ArrayParts::new(
107107
self.clone(),
@@ -130,7 +130,7 @@ impl VTable for ByteBool {
130130
) -> VortexResult<ArrayParts<Self>> {
131131
if !metadata.is_empty() {
132132
vortex_bail!(
133-
"ByteBoolArray expects empty metadata, got {} bytes",
133+
InvalidArgument: "ByteBoolArray expects empty metadata, got {} bytes",
134134
metadata.len()
135135
);
136136
}
@@ -140,11 +140,11 @@ impl VTable for ByteBool {
140140
let validity = children.get(0, &Validity::DTYPE, len)?;
141141
Validity::Array(validity)
142142
} else {
143-
vortex_bail!("Expected 0 or 1 child, got {}", children.len());
143+
vortex_bail!(MismatchedTypes: "Expected 0 or 1 child, got {}", children.len());
144144
};
145145

146146
if buffers.len() != 1 {
147-
vortex_bail!("Expected 1 buffer, got {}", buffers.len());
147+
vortex_bail!(InvalidArgument: "Expected 1 buffer, got {}", buffers.len());
148148
}
149149
let buffer = buffers[0].clone();
150150

@@ -261,10 +261,10 @@ impl ByteBoolData {
261261
len: usize,
262262
) -> VortexResult<()> {
263263
let expected_dtype = DType::Bool(validity.nullability());
264-
vortex_ensure_eq!(dtype, &expected_dtype);
265-
vortex_ensure_eq!(buffer.len(), len);
264+
vortex_ensure_eq!(dtype, &expected_dtype, MismatchedTypes);
265+
vortex_ensure_eq!(buffer.len(), len, InvalidArgument);
266266
if let Some(vlen) = validity.maybe_len() {
267-
vortex_ensure_eq!(vlen, len);
267+
vortex_ensure_eq!(vlen, len, InvalidArgument);
268268
}
269269
Ok(())
270270
}

0 commit comments

Comments
 (0)