mirror of
				https://github.com/meilisearch/meilisearch.git
				synced 2025-10-31 07:56:28 +00:00 
			
		
		
		
	review changes
This commit is contained in:
		| @@ -14,9 +14,9 @@ use crate::index_controller::error::IndexControllerError; | ||||
|  | ||||
| #[derive(Debug, thiserror::Error)] | ||||
| pub enum AuthenticationError { | ||||
|     #[error("You must have an authorization token")] | ||||
|     #[error("you must have an authorization token")] | ||||
|     MissingAuthorizationHeader, | ||||
|     #[error("Invalid API key")] | ||||
|     #[error("invalid API key")] | ||||
|     InvalidToken(String), | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -3,7 +3,7 @@ use std::io::{BufRead, BufReader, Write}; | ||||
| use std::path::Path; | ||||
| use std::sync::Arc; | ||||
|  | ||||
| use anyhow::Context; | ||||
| use anyhow::{Context, bail}; | ||||
| use heed::RoTxn; | ||||
| use indexmap::IndexMap; | ||||
| use milli::update::{IndexDocumentsMethod, UpdateFormat::JsonStream}; | ||||
| @@ -126,7 +126,7 @@ impl Index { | ||||
|  | ||||
|         match Arc::try_unwrap(index.0) { | ||||
|             Ok(inner) => inner.prepare_for_closing().wait(), | ||||
|             Err(_) => todo!("Could not close index properly."), | ||||
|             Err(_) => bail!("Could not close index properly."), | ||||
|         } | ||||
|  | ||||
|         Ok(()) | ||||
|   | ||||
| @@ -9,9 +9,9 @@ pub type Result<T> = std::result::Result<T, IndexError>; | ||||
|  | ||||
| #[derive(Debug, thiserror::Error)] | ||||
| pub enum IndexError { | ||||
|     #[error("Internal error: {0}")] | ||||
|     #[error("internal error: {0}")] | ||||
|     Internal(Box<dyn Error + Send + Sync + 'static>), | ||||
|     #[error("Document with id {0} not found.")] | ||||
|     #[error("document with id {0} not found.")] | ||||
|     DocumentNotFound(String), | ||||
|     #[error("error with facet: {0}")] | ||||
|     Facet(#[from] FacetError), | ||||
| @@ -39,7 +39,7 @@ impl ErrorCode for IndexError { | ||||
|  | ||||
| #[derive(Debug, thiserror::Error)] | ||||
| pub enum FacetError { | ||||
|     #[error("Invalid facet expression, expected {}, found: {1}", .0.join(", "))] | ||||
|     #[error("invalid facet expression, expected {}, found: {1}", .0.join(", "))] | ||||
|     InvalidExpression(&'static [&'static str], Value), | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -11,7 +11,7 @@ pub enum DumpActorError { | ||||
|     DumpAlreadyRunning, | ||||
|     #[error("dump `{0}` does not exist")] | ||||
|     DumpDoesNotExist(String), | ||||
|     #[error("Internal error: {0}")] | ||||
|     #[error("internal error: {0}")] | ||||
|     Internal(Box<dyn std::error::Error + Send + Sync + 'static>), | ||||
|     #[error("error while dumping uuids: {0}")] | ||||
|     UuidResolver(#[from] UuidResolverError), | ||||
|   | ||||
| @@ -10,7 +10,7 @@ pub type Result<T> = std::result::Result<T, IndexControllerError>; | ||||
|  | ||||
| #[derive(Debug, thiserror::Error)] | ||||
| pub enum IndexControllerError { | ||||
|     #[error("Missing index uid")] | ||||
|     #[error("missing index uid")] | ||||
|     MissingUid, | ||||
|     #[error("index resolution error: {0}")] | ||||
|     Uuid(#[from] UuidResolverError), | ||||
|   | ||||
| @@ -10,11 +10,11 @@ pub enum IndexActorError { | ||||
|     IndexError(#[from] IndexError), | ||||
|     #[error("index already exists")] | ||||
|     IndexAlreadyExists, | ||||
|     #[error("Index doesn't exists")] | ||||
|     #[error("index doesn't exists")] | ||||
|     UnexistingIndex, | ||||
|     #[error("Existing primary key")] | ||||
|     #[error("existing primary key")] | ||||
|     ExistingPrimaryKey, | ||||
|     #[error("Internal Index Error: {0}")] | ||||
|     #[error("internal Index Error: {0}")] | ||||
|     Internal(Box<dyn std::error::Error + Send + Sync + 'static>), | ||||
|     #[error("{0}")] | ||||
|     Milli(#[from] milli::Error), | ||||
|   | ||||
| @@ -330,10 +330,10 @@ impl IndexController { | ||||
|     pub async fn update_index( | ||||
|         &self, | ||||
|         uid: String, | ||||
|         index_settings: IndexSettings, | ||||
|         mut index_settings: IndexSettings, | ||||
|     ) -> Result<IndexMetadata> { | ||||
|         if index_settings.uid.is_some() { | ||||
|             todo!("Can't change the index uid.") | ||||
|             index_settings.uid.take(); | ||||
|         } | ||||
|  | ||||
|         let uuid = self.uuid_resolver.get(uid.clone()).await?; | ||||
|   | ||||
| @@ -1,6 +1,7 @@ | ||||
| use std::path::{Path, PathBuf}; | ||||
| use std::time::Duration; | ||||
|  | ||||
| use anyhow::bail; | ||||
| use log::{error, info}; | ||||
| use tokio::fs; | ||||
| use tokio::task::spawn_blocking; | ||||
| @@ -108,7 +109,7 @@ pub fn load_snapshot( | ||||
|             } | ||||
|         } | ||||
|     } else if db_path.as_ref().exists() && !ignore_snapshot_if_db_exists { | ||||
|         todo!( | ||||
|         bail!( | ||||
|             "database already exists at {:?}, try to delete it or rename it", | ||||
|             db_path | ||||
|                 .as_ref() | ||||
| @@ -116,7 +117,7 @@ pub fn load_snapshot( | ||||
|                 .unwrap_or_else(|_| db_path.as_ref().to_owned()) | ||||
|         ) | ||||
|     } else if !snapshot_path.as_ref().exists() && !ignore_missing_snapshot { | ||||
|         todo!( | ||||
|         bail!( | ||||
|             "snapshot doesn't exist at {:?}", | ||||
|             snapshot_path | ||||
|                 .as_ref() | ||||
|   | ||||
| @@ -9,14 +9,14 @@ pub type Result<T> = std::result::Result<T, UpdateActorError>; | ||||
| #[derive(Debug, thiserror::Error)] | ||||
| #[allow(clippy::large_enum_variant)] | ||||
| pub enum UpdateActorError { | ||||
|     #[error("Update {0} doesn't exist.")] | ||||
|     #[error("update {0} doesn't exist.")] | ||||
|     UnexistingUpdate(u64), | ||||
|     #[error("Internal error processing update: {0}")] | ||||
|     #[error("internal error processing update: {0}")] | ||||
|     Internal(Box<dyn Error + Send + Sync + 'static>), | ||||
|     #[error("error with index: {0}")] | ||||
|     IndexActor(#[from] IndexActorError), | ||||
|     #[error( | ||||
|         "Update store was shut down due to a fatal error, please check your logs for more info." | ||||
|         "update store was shut down due to a fatal error, please check your logs for more info." | ||||
|     )] | ||||
|     FatalUpdateStoreError, | ||||
| } | ||||
|   | ||||
| @@ -4,13 +4,13 @@ pub type Result<T> = std::result::Result<T, UuidResolverError>; | ||||
|  | ||||
| #[derive(Debug, thiserror::Error)] | ||||
| pub enum UuidResolverError { | ||||
|     #[error("Name already exist.")] | ||||
|     #[error("name already exist.")] | ||||
|     NameAlreadyExist, | ||||
|     #[error("Index \"{0}\" doesn't exist.")] | ||||
|     #[error("index \"{0}\" doesn't exist.")] | ||||
|     UnexistingIndex(String), | ||||
|     #[error("Badly formatted index uid: {0}")] | ||||
|     #[error("badly formatted index uid: {0}")] | ||||
|     BadlyFormatted(String), | ||||
|     #[error("Internal error resolving index uid: {0}")] | ||||
|     #[error("internal error resolving index uid: {0}")] | ||||
|     Internal(Box<dyn std::error::Error + Sync + Send + 'static>), | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user