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(crate) use ann_error::ensure_positive;
8pub use ann_error::{ANNError, ANNErrorKind, ANNResult, DiskANNError, ErrorContext, IntoANNResult};
9
10pub(crate) mod ranked;
11pub use ranked::{ErrorExt, Infallible, NeverTransient, RankedError, ToRanked, TransientError};
12
13pub trait StandardError: std::error::Error + Send + Sync + 'static + Into<ANNError> {}
14impl<T> StandardError for T where T: std::error::Error + Send + Sync + 'static + Into<ANNError> {}
15
16#[cfg(any(test, feature = "testing"))]
17macro_rules! message {
18    ($kind:ident, $($args:tt)*) => {
19        $crate::ANNError::message($kind, format!($($args)*))
20    };
21    ($($args:tt)*) => {
22        $crate::ANNError::message($crate::ANNErrorKind::Opaque, format!($($args)*))
23    };
24}
25
26#[cfg(any(test, feature = "testing"))]
27pub(crate) use message;