mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 20:37:15 +02:00
Return an error when calling DELETE /tasks with an empty query
This commit is contained in:
parent
9067148270
commit
dabc30d3d6
4 changed files with 28 additions and 1 deletions
|
@ -15,7 +15,9 @@ pub enum Error {
|
|||
CorruptedTaskQueue,
|
||||
#[error("Task `{0}` not found")]
|
||||
TaskNotFound(TaskId),
|
||||
|
||||
// TODO: Lo: proper error message for this
|
||||
#[error("Cannot delete all tasks")]
|
||||
TaskDeletionWithEmptyQuery,
|
||||
// maybe the two next errors are going to move to the frontend
|
||||
#[error("`{0}` is not a status. Available status are")]
|
||||
InvalidStatus(String),
|
||||
|
@ -41,6 +43,7 @@ impl ErrorCode for Error {
|
|||
Error::IndexNotFound(_) => Code::IndexNotFound,
|
||||
Error::IndexAlreadyExists(_) => Code::IndexAlreadyExists,
|
||||
Error::TaskNotFound(_) => Code::TaskNotFound,
|
||||
Error::TaskDeletionWithEmptyQuery => Code::TaskDeletionWithEmptyQuery,
|
||||
Error::InvalidStatus(_) => Code::BadRequest,
|
||||
Error::InvalidKind(_) => Code::BadRequest,
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue