diff --git a/dump/src/error.rs b/dump/src/error.rs index 0d57729ae..873a6bbfd 100644 --- a/dump/src/error.rs +++ b/dump/src/error.rs @@ -19,9 +19,9 @@ pub enum Error { impl ErrorCode for Error { fn error_code(&self) -> Code { match self { - // Are these three really Internal errors? - // TODO look at that later. - Error::Io(_) => Code::Internal, + Error::Io(e) => e.error_code(), + + // These error come from an internal mis Error::Serde(_) => Code::Internal, Error::Uuid(_) => Code::Internal, diff --git a/dump/src/reader/error.rs b/dump/src/reader/error.rs deleted file mode 100644 index 679fa2bc2..000000000 --- a/dump/src/reader/error.rs +++ /dev/null @@ -1,42 +0,0 @@ -use meilisearch_auth::error::AuthControllerError; -use meilisearch_types::error::{Code, ErrorCode}; -use meilisearch_types::internal_error; - -use crate::{index_resolver::error::IndexResolverError, tasks::error::TaskError}; - -pub type Result = std::result::Result; - -#[derive(thiserror::Error, Debug)] -pub enum DumpError { - #[error("An internal error has occurred. `{0}`.")] - Internal(Box), - #[error("{0}")] - IndexResolver(Box), -} - -internal_error!( - DumpError: milli::heed::Error, - std::io::Error, - tokio::task::JoinError, - tokio::sync::oneshot::error::RecvError, - serde_json::error::Error, - tempfile::PersistError, - fs_extra::error::Error, - AuthControllerError, - TaskError -); - -impl From for DumpError { - fn from(e: IndexResolverError) -> Self { - Self::IndexResolver(Box::new(e)) - } -} - -impl ErrorCode for DumpError { - fn error_code(&self) -> Code { - match self { - DumpError::Internal(_) => Code::Internal, - DumpError::IndexResolver(e) => e.error_code(), - } - } -} diff --git a/meilisearch-types/src/error.rs b/meilisearch-types/src/error.rs index 402390068..6e84378e2 100644 --- a/meilisearch-types/src/error.rs +++ b/meilisearch-types/src/error.rs @@ -462,8 +462,7 @@ impl ErrorCode for io::Error { Some(5) => Code::IoError, Some(24) => Code::TooManyOpenFiles, Some(28) => Code::NoSpaceLeftOnDevice, - e => todo!("missed something asshole {:?}", e), - // e => Code::Internal, + _ => Code::Internal, } } }