Skip to main content

diskann/error/
mod.rs

1/*
2 * Copyright (c) Microsoft Corporation.
3 * Licensed under the MIT license.
4 */
5
6pub(crate) mod ann_error;
7pub use ann_error::{ANNError, ANNErrorKind, ANNResult, DiskANNError, ErrorContext, IntoANNResult};
8
9pub(crate) mod ranked;
10pub use ranked::{ErrorExt, Infallible, NeverTransient, RankedError, ToRanked, TransientError};
11
12pub trait StandardError: std::error::Error + Send + Sync + 'static + Into<ANNError> {}
13impl<T> StandardError for T where T: std::error::Error + Send + Sync + 'static + Into<ANNError> {}
14
15#[cfg(any(test, feature = "testing"))]
16macro_rules! message {
17    ($kind:ident, $($args:tt)*) => {
18        $crate::ANNError::message($kind, format!($($args)*))
19    };
20    ($($args:tt)*) => {
21        $crate::ANNError::message($crate::ANNErrorKind::Opaque, format!($($args)*))
22    };
23}
24
25#[cfg(any(test, feature = "testing"))]
26pub(crate) use message;