From 11e00c906f185ecfb4653c6fdbdd84061cd39fb6 Mon Sep 17 00:00:00 2001 From: mpostma Date: Fri, 5 Jun 2020 11:33:59 +0200 Subject: [PATCH] error when deleting unexisting index --- meilisearch-http/src/routes/index.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/meilisearch-http/src/routes/index.rs b/meilisearch-http/src/routes/index.rs index 25fd3f17f..d3f30711c 100644 --- a/meilisearch-http/src/routes/index.rs +++ b/meilisearch-http/src/routes/index.rs @@ -311,9 +311,11 @@ async fn delete_index( data: web::Data, path: web::Path, ) -> Result { - data.db.delete_index(&path.index_uid)?; - - Ok(HttpResponse::NoContent().finish()) + if data.db.delete_index(&path.index_uid)? { + Ok(HttpResponse::NoContent().finish()) + } else { + Err(Error::index_not_found(&path.index_uid).into()) + } } #[derive(Deserialize)]