• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

vortex-data / vortex / 16992591828

15 Aug 2025 02:51PM UTC coverage: 87.203% (-0.5%) from 87.72%
16992591828

Pull #2456

github

web-flow
Merge fe7e226a7 into 4a23f65b3
Pull Request #2456: feat: basic BoolBuffer / BoolBufferMut

476 of 1230 new or added lines in 107 files covered. (38.7%)

74 existing lines in 19 files now uncovered.

56525 of 64820 relevant lines covered (87.2%)

623751.88 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

55.74
/vortex-error/src/lib.rs
1
// SPDX-License-Identifier: Apache-2.0
2
// SPDX-FileCopyrightText: Copyright the Vortex contributors
3

4
#![deny(missing_docs)]
5

6
//! This crate defines error & result types for Vortex.
7
//! It also contains a variety of useful macros for error handling.
8

9
#[cfg(feature = "python")]
10
pub mod python;
11

12
use std::backtrace::Backtrace;
13
use std::borrow::Cow;
14
use std::convert::Infallible;
15
use std::error::Error;
16
use std::fmt::{Debug, Display, Formatter};
17
use std::num::TryFromIntError;
18
use std::ops::Deref;
19
use std::sync::{Arc, PoisonError};
20
use std::{env, fmt, io};
21

22
/// A string that can be used as an error message.
23
#[derive(Debug)]
24
pub struct ErrString(Cow<'static, str>);
25

26
#[allow(clippy::fallible_impl_from)]
27
impl<T> From<T> for ErrString
28
where
29
    T: Into<Cow<'static, str>>,
30
{
31
    #[allow(clippy::panic)]
32
    fn from(msg: T) -> Self {
7,305,565✔
33
        if env::var("VORTEX_PANIC_ON_ERR").as_deref().unwrap_or("") == "1" {
7,305,565✔
34
            panic!("{}\nBacktrace:\n{}", msg.into(), Backtrace::capture());
×
35
        } else {
36
            Self(msg.into())
7,305,565✔
37
        }
38
    }
7,305,565✔
39
}
40

41
impl AsRef<str> for ErrString {
42
    fn as_ref(&self) -> &str {
×
43
        &self.0
×
44
    }
×
45
}
46

47
impl Deref for ErrString {
48
    type Target = str;
49

50
    fn deref(&self) -> &Self::Target {
×
51
        &self.0
×
52
    }
×
53
}
54

55
impl Display for ErrString {
56
    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
5,984✔
57
        Display::fmt(&self.0, f)
5,984✔
58
    }
5,984✔
59
}
60

61
impl From<Infallible> for VortexError {
62
    fn from(_: Infallible) -> Self {
×
63
        unreachable!()
×
64
    }
65
}
66

67
const _: () = {
68
    assert!(size_of::<VortexError>() < 128);
69
};
70
/// The top-level error type for Vortex.
71
#[non_exhaustive]
72
pub enum VortexError {
73
    /// A wrapped generic error
74
    Generic(Box<dyn Error + Send + Sync + 'static>, Box<Backtrace>),
75
    /// An index is out of bounds.
76
    OutOfBounds(usize, usize, usize, Box<Backtrace>),
77
    /// An error occurred while executing a compute kernel.
78
    ComputeError(ErrString, Box<Backtrace>),
79
    /// An invalid argument was provided.
80
    InvalidArgument(ErrString, Box<Backtrace>),
81
    /// The system has reached an invalid state,
82
    InvalidState(ErrString, Box<Backtrace>),
83
    /// An error occurred while serializing or deserializing.
84
    InvalidSerde(ErrString, Box<Backtrace>),
85
    /// An unimplemented function was called.
86
    NotImplemented(ErrString, ErrString, Box<Backtrace>),
87
    /// A type mismatch occurred.
88
    MismatchedTypes(ErrString, ErrString, Box<Backtrace>),
89
    /// An assertion failed.
90
    AssertionFailed(ErrString, Box<Backtrace>),
91
    /// A wrapper for other errors, carrying additional context.
92
    Context(ErrString, Box<VortexError>),
93
    /// A wrapper for shared errors that require cloning.
94
    Shared(Arc<VortexError>),
95
    /// A wrapper for errors from the Arrow library.
96
    ArrowError(arrow_schema::ArrowError, Box<Backtrace>),
97
    /// A wrapper for errors from the FlatBuffers library.
98
    #[cfg(feature = "flatbuffers")]
99
    FlatBuffersError(flatbuffers::InvalidFlatbuffer, Box<Backtrace>),
100
    /// A wrapper for formatting errors.
101
    FmtError(fmt::Error, Box<Backtrace>),
102
    /// A wrapper for IO errors.
103
    IOError(io::Error, Box<Backtrace>),
104
    /// A wrapper for UTF-8 conversion errors.
105
    Utf8Error(std::str::Utf8Error, Box<Backtrace>),
106
    /// A wrapper for errors from the Parquet library.
107
    #[cfg(feature = "parquet")]
108
    ParquetError(parquet::errors::ParquetError, Box<Backtrace>),
109
    /// A wrapper for errors from the standard library when converting a slice to an array.
110
    TryFromSliceError(std::array::TryFromSliceError, Box<Backtrace>),
111
    /// A wrapper for errors from the Object Store library.
112
    #[cfg(feature = "object_store")]
113
    ObjectStore(object_store::Error, Box<Backtrace>),
114
    /// A wrapper for errors from the Jiff library.
115
    JiffError(jiff::Error, Box<Backtrace>),
116
    /// A wrapper for Tokio join error.
117
    #[cfg(feature = "tokio")]
118
    JoinError(tokio::task::JoinError, Box<Backtrace>),
119
    /// A wrapper for URL parsing errors.
120
    UrlError(url::ParseError, Box<Backtrace>),
121
    /// Wrap errors for fallible integer casting.
122
    TryFromInt(TryFromIntError, Box<Backtrace>),
123
    /// Wrap serde and serde json errors
124
    #[cfg(feature = "serde")]
125
    SerdeJsonError(serde_json::Error, Box<Backtrace>),
126
    /// Wrap prost encode error
127
    #[cfg(feature = "prost")]
128
    ProstEncodeError(prost::EncodeError, Box<Backtrace>),
129
    /// Wrap prost decode error
130
    #[cfg(feature = "prost")]
131
    ProstDecodeError(prost::DecodeError, Box<Backtrace>),
132
    /// Wrap prost unknown enum value
133
    #[cfg(feature = "prost")]
134
    ProstUnknownEnumValue(prost::UnknownEnumValue, Box<Backtrace>),
135
}
136

137
impl VortexError {
138
    /// Adds additional context to an error.
139
    pub fn with_context<T: Into<ErrString>>(self, msg: T) -> Self {
126✔
140
        VortexError::Context(msg.into(), Box::new(self))
126✔
141
    }
126✔
142
}
143

144
impl Display for VortexError {
145
    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
6,028✔
146
        match self {
6,028✔
147
            VortexError::Generic(err, backtrace) => {
×
148
                write!(f, "{err}\nBacktrace:\n{backtrace}")
×
149
            }
150
            VortexError::OutOfBounds(idx, start, stop, backtrace) => {
44✔
151
                write!(
44✔
152
                    f,
44✔
153
                    "index {idx} out of bounds from {start} to {stop}\nBacktrace:\n{backtrace}",
44✔
154
                )
155
            }
156
            VortexError::ComputeError(msg, backtrace) => {
157
                write!(f, "{msg}\nBacktrace:\n{backtrace}")
158
            }
159
            VortexError::InvalidArgument(msg, backtrace) => {
5,632✔
160
                write!(f, "{msg}\nBacktrace:\n{backtrace}")
5,632✔
161
            }
162
            VortexError::InvalidState(msg, backtrace) => {
×
163
                write!(f, "{msg}\nBacktrace:\n{backtrace}")
164
            }
165
            VortexError::InvalidSerde(msg, backtrace) => {
132✔
166
                write!(f, "{msg}\nBacktrace:\n{backtrace}")
132✔
167
            }
168
            VortexError::NotImplemented(func, by_whom, backtrace) => {
×
169
                write!(
170
                    f,
×
171
                    "function {func} not implemented for {by_whom}\nBacktrace:\n{backtrace}",
×
172
                )
173
            }
174
            VortexError::MismatchedTypes(expected, actual, backtrace) => {
175
                write!(
176
                    f,
×
177
                    "expected type: {expected} but instead got {actual}\nBacktrace:\n{backtrace}",
×
178
                )
179
            }
180
            VortexError::AssertionFailed(msg, backtrace) => {
88✔
181
                write!(f, "{msg}\nBacktrace:\n{backtrace}")
88✔
182
            }
183
            VortexError::Context(msg, inner) => {
44✔
184
                write!(f, "{msg}: {inner}")
44✔
185
            }
186
            VortexError::Shared(inner) => Display::fmt(inner, f),
44✔
187
            VortexError::ArrowError(err, backtrace) => {
44✔
188
                write!(f, "{err}\nBacktrace:\n{backtrace}")
44✔
189
            }
190
            #[cfg(feature = "flatbuffers")]
191
            VortexError::FlatBuffersError(err, backtrace) => {
192
                write!(f, "{err}\nBacktrace:\n{backtrace}")
193
            }
194
            VortexError::FmtError(err, backtrace) => {
×
195
                write!(f, "{err}\nBacktrace:\n{backtrace}")
196
            }
197
            VortexError::IOError(err, backtrace) => {
×
198
                write!(f, "{err}\nBacktrace:\n{backtrace}")
199
            }
200
            VortexError::Utf8Error(err, backtrace) => {
×
201
                write!(f, "{err}\nBacktrace:\n{backtrace}")
202
            }
203
            #[cfg(feature = "parquet")]
204
            VortexError::ParquetError(err, backtrace) => {
UNCOV
205
                write!(f, "{err}\nBacktrace:\n{backtrace}")
×
206
            }
207
            VortexError::TryFromSliceError(err, backtrace) => {
208
                write!(f, "{err}\nBacktrace:\n{backtrace}")
209
            }
210
            #[cfg(feature = "object_store")]
211
            VortexError::ObjectStore(err, backtrace) => {
212
                write!(f, "{err}\nBacktrace:\n{backtrace}")
×
213
            }
214
            VortexError::JiffError(err, backtrace) => {
215
                write!(f, "{err}\nBacktrace:\n{backtrace}")
216
            }
217
            #[cfg(feature = "tokio")]
218
            VortexError::JoinError(err, backtrace) => {
219
                write!(f, "{err}\nBacktrace:\n{backtrace}")
×
220
            }
221
            VortexError::UrlError(err, backtrace) => {
222
                write!(f, "{err}\nBacktrace:\n{backtrace}")
×
223
            }
224
            VortexError::TryFromInt(err, backtrace) => {
225
                write!(f, "{err}\nBacktrace:\n{backtrace}")
226
            }
227
            #[cfg(feature = "serde")]
228
            VortexError::SerdeJsonError(err, backtrace) => {
229
                write!(f, "{err}\nBacktrace:\n{backtrace}")
230
            }
231
            #[cfg(feature = "prost")]
232
            VortexError::ProstEncodeError(err, backtrace) => {
233
                write!(f, "{err}\nBacktrace:\n{backtrace}")
234
            }
235
            #[cfg(feature = "prost")]
236
            VortexError::ProstDecodeError(err, backtrace) => {
237
                write!(f, "{err}\nBacktrace:\n{backtrace}")
238
            }
239
            #[cfg(feature = "prost")]
240
            VortexError::ProstUnknownEnumValue(err, backtrace) => {
241
                write!(f, "{err}\nBacktrace:\n{backtrace}")
242
            }
243
        }
244
    }
6,028✔
245
}
246

247
impl Error for VortexError {
248
    fn source(&self) -> Option<&(dyn Error + 'static)> {
×
249
        match self {
×
250
            VortexError::Generic(err, _) => Some(err.as_ref()),
×
251
            VortexError::Context(_, inner) => inner.source(),
×
252
            VortexError::Shared(inner) => inner.source(),
253
            VortexError::ArrowError(err, _) => Some(err),
×
254
            #[cfg(feature = "flatbuffers")]
255
            VortexError::FlatBuffersError(err, _) => Some(err),
256
            VortexError::FmtError(err, _) => Some(err),
×
257
            VortexError::IOError(err, _) => Some(err),
×
258
            VortexError::Utf8Error(err, _) => Some(err),
259
            #[cfg(feature = "parquet")]
UNCOV
260
            VortexError::ParquetError(err, _) => Some(err),
×
261
            VortexError::TryFromSliceError(err, _) => Some(err),
262
            #[cfg(feature = "object_store")]
263
            VortexError::ObjectStore(err, _) => Some(err),
264
            VortexError::JiffError(err, _) => Some(err),
×
265
            #[cfg(feature = "tokio")]
266
            VortexError::JoinError(err, _) => Some(err),
×
267
            VortexError::UrlError(err, _) => Some(err),
268
            VortexError::TryFromInt(err, _) => Some(err),
×
269
            #[cfg(feature = "serde")]
270
            VortexError::SerdeJsonError(err, _) => Some(err),
271
            #[cfg(feature = "prost")]
272
            VortexError::ProstEncodeError(err, _) => Some(err),
273
            #[cfg(feature = "prost")]
274
            VortexError::ProstDecodeError(err, _) => Some(err),
275
            #[cfg(feature = "prost")]
276
            VortexError::ProstUnknownEnumValue(err, _) => Some(err),
×
277
            _ => None,
×
278
        }
279
    }
280
}
281

282
impl Debug for VortexError {
283
    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
616✔
284
        Display::fmt(self, f)
616✔
285
    }
616✔
286
}
287

288
/// A type alias for Results that return VortexErrors as their error type.
289
pub type VortexResult<T> = Result<T, VortexError>;
290

291
/// A vortex result that can be shared or cloned.
292
pub type SharedVortexResult<T> = Result<T, Arc<VortexError>>;
293

294
impl From<Arc<VortexError>> for VortexError {
295
    fn from(value: Arc<VortexError>) -> Self {
88✔
296
        Self::from(&value)
88✔
297
    }
88✔
298
}
299

300
impl From<&Arc<VortexError>> for VortexError {
301
    fn from(e: &Arc<VortexError>) -> Self {
88✔
302
        if let VortexError::Shared(e_inner) = e.as_ref() {
88✔
303
            // don't re-wrap
304
            VortexError::Shared(Arc::clone(e_inner))
305
        } else {
306
            VortexError::Shared(Arc::clone(e))
88✔
307
        }
308
    }
88✔
309
}
310

311
/// A trait for unwrapping a VortexResult.
312
pub trait VortexUnwrap {
313
    /// The type of the value being unwrapped.
314
    type Output;
315

316
    /// Returns the value of the result if it is Ok, otherwise panics with the error.
317
    /// Should be called only in contexts where the error condition represents a bug (programmer error).
318
    fn vortex_unwrap(self) -> Self::Output;
319
}
320

1,646✔
321
impl<T, E> VortexUnwrap for Result<T, E>
1,646✔
322
where
1,646✔
323
    E: Into<VortexError>,
1,646✔
324
{
325
    type Output = T;
326

327
    #[inline(always)]
328
    fn vortex_unwrap(self) -> Self::Output {
77,182,804✔
329
        self.map_err(|err| err.into())
77,182,804✔
330
            .unwrap_or_else(|err| vortex_panic!(err))
77,182,804✔
331
    }
77,182,804✔
332
}
333

334
/// A trait for expect-ing a VortexResult or an Option.
335
pub trait VortexExpect {
336
    /// The type of the value being expected.
337
    type Output;
338

339
    /// Returns the value of the result if it is Ok, otherwise panics with the error.
340
    /// Should be called only in contexts where the error condition represents a bug (programmer error).
341
    fn vortex_expect(self, msg: &str) -> Self::Output;
342
}
343

1,644✔
344
impl<T, E> VortexExpect for Result<T, E>
1,644✔
345
where
1,644✔
346
    E: Into<VortexError>,
1,644✔
347
{
348
    type Output = T;
349

350
    #[inline(always)]
351
    fn vortex_expect(self, msg: &str) -> Self::Output {
147,703,215✔
352
        self.map_err(|err| err.into())
147,703,215✔
353
            .unwrap_or_else(|e| vortex_panic!(e.with_context(msg.to_string())))
147,726,805✔
354
    }
147,726,805✔
355
}
356

357
impl<T> VortexExpect for Option<T> {
358
    type Output = T;
359

360
    #[inline(always)]
361
    fn vortex_expect(self, msg: &str) -> Self::Output {
109,172,430✔
362
        self.unwrap_or_else(|| {
109,148,840✔
363
            let err = VortexError::AssertionFailed(
2✔
364
                msg.to_string().into(),
2✔
365
                Box::new(Backtrace::capture()),
2✔
366
            );
2✔
367
            vortex_panic!(err)
2✔
368
        })
369
    }
109,148,840✔
370
}
371

372
/// A convenient macro for creating a VortexError.
373
#[macro_export]
374
macro_rules! vortex_err {
375
    (AssertionFailed: $($tts:tt)*) => {{
376
        use std::backtrace::Backtrace;
377
        let err_string = format!($($tts)*);
378
        $crate::__private::must_use(
379
            $crate::VortexError::AssertionFailed(err_string.into(), Box::new(Backtrace::capture()))
380
        )
381
    }};
382
    (IOError: $($tts:tt)*) => {{
383
        use std::backtrace::Backtrace;
384
        $crate::__private::must_use(
385
            $crate::VortexError::IOError(err_string.into(), Box::new(Backtrace::capture()))
386
        )
387
    }};
388
    (OutOfBounds: $idx:expr, $start:expr, $stop:expr) => {{
389
        use std::backtrace::Backtrace;
390
        $crate::__private::must_use(
391
            $crate::VortexError::OutOfBounds($idx, $start, $stop, Box::new(Backtrace::capture()))
392
        )
393
    }};
394
    (NotImplemented: $func:expr, $by_whom:expr) => {{
395
        use std::backtrace::Backtrace;
396
        $crate::__private::must_use(
397
            $crate::VortexError::NotImplemented($func.into(), format!("{}", $by_whom).into(), Box::new(Backtrace::capture()))
398
        )
399
    }};
400
    (MismatchedTypes: $expected:literal, $actual:expr) => {{
401
        use std::backtrace::Backtrace;
402
        $crate::__private::must_use(
403
            $crate::VortexError::MismatchedTypes($expected.into(), $actual.to_string().into(), Box::new(Backtrace::capture()))
404
        )
405
    }};
406
    (MismatchedTypes: $expected:expr, $actual:expr) => {{
407
        use std::backtrace::Backtrace;
408
        $crate::__private::must_use(
409
            $crate::VortexError::MismatchedTypes($expected.to_string().into(), $actual.to_string().into(), Box::new(Backtrace::capture()))
410
        )
411
    }};
412
    (Context: $msg:literal, $err:expr) => {{
413
        $crate::__private::must_use(
414
            $crate::VortexError::Context($msg.into(), Box::new($err))
415
        )
416
    }};
417
    ($variant:ident: $fmt:literal $(, $arg:expr)* $(,)?) => {{
418
        use std::backtrace::Backtrace;
419
        $crate::__private::must_use(
420
            $crate::VortexError::$variant(format!($fmt, $($arg),*).into(), Box::new(Backtrace::capture()))
421
        )
422
    }};
423
    ($variant:ident: $err:expr $(,)?) => {
424
        $crate::__private::must_use(
425
            $crate::VortexError::$variant($err)
426
        )
427
    };
428
    ($fmt:literal $(, $arg:expr)* $(,)?) => {
429
        $crate::vortex_err!(InvalidArgument: $fmt, $($arg),*)
430
    };
431
}
432

433
/// A convenient macro for returning a VortexError.
434
#[macro_export]
435
macro_rules! vortex_bail {
436
    ($($tt:tt)+) => {
437
        return Err($crate::vortex_err!($($tt)+))
438
    };
439
}
440

441
/// A convenient macro for panicking with a VortexError in the presence of a programmer error
442
/// (e.g., an invariant has been violated).
443
#[macro_export]
444
macro_rules! vortex_panic {
445
    (OutOfBounds: $idx:expr, $start:expr, $stop:expr) => {{
446
        $crate::vortex_panic!($crate::vortex_err!(OutOfBounds: $idx, $start, $stop))
447
    }};
448
    (NotImplemented: $func:expr, $for_whom:expr) => {{
449
        $crate::vortex_panic!($crate::vortex_err!(NotImplemented: $func, $for_whom))
450
    }};
451
    (MismatchedTypes: $expected:literal, $actual:expr) => {{
452
        $crate::vortex_panic!($crate::vortex_err!(MismatchedTypes: $expected, $actual))
453
    }};
454
    (MismatchedTypes: $expected:expr, $actual:expr) => {{
455
        $crate::vortex_panic!($crate::vortex_err!(MismatchedTypes: $expected, $actual))
456
    }};
457
    (Context: $msg:literal, $err:expr) => {{
458
        $crate::vortex_panic!($crate::vortex_err!(Context: $msg, $err))
459
    }};
460
    ($variant:ident: $fmt:literal $(, $arg:expr)* $(,)?) => {
461
        $crate::vortex_panic!($crate::vortex_err!($variant: $fmt, $($arg),*))
462
    };
463
    ($err:expr, $fmt:literal $(, $arg:expr)* $(,)?) => {{
464
        let err: $crate::VortexError = $err;
465
        panic!("{}", err.with_context(format!($fmt, $($arg),*)))
466
    }};
467
    ($fmt:literal $(, $arg:expr)* $(,)?) => {
468
        $crate::vortex_panic!($crate::vortex_err!($fmt, $($arg),*))
469
    };
470
    ($err:expr) => {{
471
        let err: $crate::VortexError = $err;
472
        panic!("{}", err)
473
    }};
474
}
475

476
impl From<arrow_schema::ArrowError> for VortexError {
477
    fn from(value: arrow_schema::ArrowError) -> Self {
13,508✔
478
        VortexError::ArrowError(value, Box::new(Backtrace::capture()))
13,508✔
479
    }
13,508✔
480
}
481

482
#[cfg(feature = "flatbuffers")]
483
impl From<flatbuffers::InvalidFlatbuffer> for VortexError {
484
    fn from(value: flatbuffers::InvalidFlatbuffer) -> Self {
×
485
        VortexError::FlatBuffersError(value, Box::new(Backtrace::capture()))
486
    }
487
}
488

489
impl From<fmt::Error> for VortexError {
490
    fn from(value: fmt::Error) -> Self {
×
491
        VortexError::FmtError(value, Box::new(Backtrace::capture()))
492
    }
493
}
494

495
impl From<io::Error> for VortexError {
496
    fn from(value: io::Error) -> Self {
×
497
        VortexError::IOError(value, Box::new(Backtrace::capture()))
498
    }
499
}
500

501
impl From<std::str::Utf8Error> for VortexError {
502
    fn from(value: std::str::Utf8Error) -> Self {
×
503
        VortexError::Utf8Error(value, Box::new(Backtrace::capture()))
×
504
    }
505
}
506

507
#[cfg(feature = "parquet")]
508
impl From<parquet::errors::ParquetError> for VortexError {
UNCOV
509
    fn from(value: parquet::errors::ParquetError) -> Self {
×
510
        VortexError::ParquetError(value, Box::new(Backtrace::capture()))
511
    }
512
}
513

514
impl From<std::array::TryFromSliceError> for VortexError {
515
    fn from(value: std::array::TryFromSliceError) -> Self {
×
516
        VortexError::TryFromSliceError(value, Box::new(Backtrace::capture()))
×
517
    }
518
}
519

520
#[cfg(feature = "object_store")]
521
impl From<object_store::Error> for VortexError {
522
    fn from(value: object_store::Error) -> Self {
×
523
        VortexError::ObjectStore(value, Box::new(Backtrace::capture()))
524
    }
525
}
526

527
impl From<jiff::Error> for VortexError {
528
    fn from(value: jiff::Error) -> Self {
×
529
        VortexError::JiffError(value, Box::new(Backtrace::capture()))
530
    }
531
}
532

533
#[cfg(feature = "tokio")]
534
impl From<tokio::task::JoinError> for VortexError {
535
    fn from(value: tokio::task::JoinError) -> Self {
536
        VortexError::JoinError(value, Box::new(Backtrace::capture()))
537
    }
538
}
539

540
impl From<url::ParseError> for VortexError {
541
    fn from(value: url::ParseError) -> Self {
×
542
        VortexError::UrlError(value, Box::new(Backtrace::capture()))
×
543
    }
544
}
545

546
impl From<TryFromIntError> for VortexError {
547
    fn from(value: TryFromIntError) -> Self {
×
548
        VortexError::TryFromInt(value, Box::new(Backtrace::capture()))
×
549
    }
×
550
}
551

552
#[cfg(feature = "serde")]
553
impl From<serde_json::Error> for VortexError {
554
    fn from(value: serde_json::Error) -> Self {
555
        VortexError::SerdeJsonError(value, Box::new(Backtrace::capture()))
556
    }
557
}
558

559
#[cfg(feature = "prost")]
560
impl From<prost::EncodeError> for VortexError {
561
    fn from(value: prost::EncodeError) -> Self {
562
        VortexError::ProstEncodeError(value, Box::new(Backtrace::capture()))
563
    }
564
}
565

566
#[cfg(feature = "prost")]
567
impl From<prost::DecodeError> for VortexError {
568
    fn from(value: prost::DecodeError) -> Self {
×
569
        VortexError::ProstDecodeError(value, Box::new(Backtrace::capture()))
570
    }
571
}
572

573
#[cfg(feature = "prost")]
574
impl From<prost::UnknownEnumValue> for VortexError {
575
    fn from(value: prost::UnknownEnumValue) -> Self {
×
576
        VortexError::ProstUnknownEnumValue(value, Box::new(Backtrace::capture()))
577
    }
578
}
579

580
// Not public, referenced by macros only.
581
#[doc(hidden)]
582
pub mod __private {
583
    #[doc(hidden)]
584
    #[inline]
585
    #[cold]
586
    #[must_use]
587
    pub const fn must_use(error: crate::VortexError) -> crate::VortexError {
180,203✔
588
        error
180,203✔
589
    }
180,203✔
590
}
591

592
impl<T> From<PoisonError<T>> for VortexError {
593
    fn from(_value: PoisonError<T>) -> Self {
594
        // We don't include the value since it may be sensitive.
595
        Self::InvalidState("Lock poisoned".into(), Box::new(Backtrace::capture()))
596
    }
597
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc