mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-03 11:57:07 +02:00
factorize internal error macro
This commit is contained in:
parent
02277ec2cf
commit
0d3fb5ee0d
11 changed files with 62 additions and 84 deletions
|
@ -15,19 +15,13 @@ pub enum IndexError {
|
|||
Facet(#[from] FacetError),
|
||||
}
|
||||
|
||||
macro_rules! internal_error {
|
||||
($($other:path), *) => {
|
||||
$(
|
||||
impl From<$other> for IndexError {
|
||||
fn from(other: $other) -> Self {
|
||||
Self::Internal(Box::new(other))
|
||||
}
|
||||
}
|
||||
)*
|
||||
}
|
||||
}
|
||||
|
||||
internal_error!(std::io::Error, heed::Error, fst::Error, serde_json::Error);
|
||||
internal_error!(
|
||||
IndexError:
|
||||
std::io::Error,
|
||||
heed::Error,
|
||||
fst::Error,
|
||||
serde_json::Error
|
||||
);
|
||||
|
||||
impl ErrorCode for IndexError {
|
||||
fn error_code(&self) -> Code {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue