Add a new meilisearch_types crate

Move `meilisearch_error` to `meilisearch_types::error`
Move `meilisearch_lib::index_resolver::IndexUid` to `meilisearch_types::index_uid`
Add a new `InvalidIndexUid` error in `meilisearch_types::index_uid`
This commit is contained in:
pierre-l 2022-06-06 12:38:46 +02:00
parent b9b32d65a8
commit 36cb09eb25
45 changed files with 172 additions and 157 deletions

View file

@ -1,7 +1,8 @@
use std::error::Error;
use meilisearch_error::Code;
use meilisearch_error::{internal_error, ErrorCode};
use meilisearch_types::error::{Code, ErrorCode};
use meilisearch_types::index_uid::IndexUidFormatError;
use meilisearch_types::internal_error;
use tokio::task::JoinError;
use super::DocumentAdditionFormat;
@ -63,3 +64,9 @@ impl ErrorCode for IndexControllerError {
}
}
}
impl From<IndexUidFormatError> for IndexControllerError {
fn from(err: IndexUidFormatError) -> Self {
IndexResolverError::from(err).into()
}
}

View file

@ -11,6 +11,7 @@ use actix_web::error::PayloadError;
use bytes::Bytes;
use futures::Stream;
use futures::StreamExt;
use meilisearch_types::index_uid::IndexUid;
use milli::update::IndexDocumentsMethod;
use serde::{Deserialize, Serialize};
use time::OffsetDateTime;
@ -37,7 +38,6 @@ use error::Result;
use self::error::IndexControllerError;
use crate::index_resolver::index_store::{IndexStore, MapIndexStore};
use crate::index_resolver::meta_store::{HeedMetaStore, IndexMetaStore};
pub use crate::index_resolver::IndexUid;
use crate::index_resolver::{create_index_resolver, IndexResolver};
use crate::update_file_store::UpdateFileStore;

View file

@ -1,7 +1,7 @@
use std::error::Error;
use std::fmt;
use meilisearch_error::{internal_error, Code, ErrorCode};
use meilisearch_types::{internal_error, Code, ErrorCode};
use crate::{
document_formats::DocumentFormatError,