mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 20:37:15 +02:00
wip integrating the scheduler in meilisearch-http
This commit is contained in:
parent
250410495c
commit
8d51c1f389
16 changed files with 251 additions and 192 deletions
|
@ -1,3 +1,4 @@
|
|||
use meilisearch_types::error::{Code, ErrorCode};
|
||||
use milli::heed;
|
||||
use thiserror::Error;
|
||||
|
||||
|
@ -13,6 +14,13 @@ pub enum Error {
|
|||
CorruptedTaskQueue,
|
||||
#[error("Task `{0}` not found")]
|
||||
TaskNotFound(TaskId),
|
||||
|
||||
// maybe the two next errors are going to move to the frontend
|
||||
#[error("`{0}` is not a status. Available status are")]
|
||||
InvalidStatus(String),
|
||||
#[error("`{0}` is not a type. Available types are")]
|
||||
InvalidKind(String),
|
||||
|
||||
#[error(transparent)]
|
||||
Heed(#[from] heed::Error),
|
||||
#[error(transparent)]
|
||||
|
@ -27,3 +35,22 @@ pub enum Error {
|
|||
#[error(transparent)]
|
||||
Anyhow(#[from] anyhow::Error),
|
||||
}
|
||||
|
||||
impl ErrorCode for Error {
|
||||
fn error_code(&self) -> Code {
|
||||
match self {
|
||||
Error::IndexNotFound(_) => Code::IndexNotFound,
|
||||
Error::IndexAlreadyExists(_) => Code::IndexAlreadyExists,
|
||||
Error::TaskNotFound(_) => Code::TaskNotFound,
|
||||
Error::InvalidStatus(_) => todo!(),
|
||||
Error::InvalidKind(_) => todo!(),
|
||||
Error::Heed(_) => todo!(),
|
||||
Error::Milli(_) => todo!(),
|
||||
Error::IndexError(_) => todo!(),
|
||||
Error::FileStore(_) => todo!(),
|
||||
Error::IoError(_) => todo!(),
|
||||
Error::Anyhow(_) => Code::Internal,
|
||||
Error::CorruptedTaskQueue => Code::Internal,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue