From db458262320d7bc7d664d425fc7d1916d453b33c Mon Sep 17 00:00:00 2001 From: mpostma Date: Fri, 29 May 2020 16:25:39 +0200 Subject: [PATCH] take existing_index out of create_index error --- meilisearch-http/src/routes/index.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/meilisearch-http/src/routes/index.rs b/meilisearch-http/src/routes/index.rs index f12179902..25fd3f17f 100644 --- a/meilisearch-http/src/routes/index.rs +++ b/meilisearch-http/src/routes/index.rs @@ -178,7 +178,10 @@ async fn create_index( let created_index = data .db .create_index(&uid) - .map_err(Error::create_index)?; + .map_err(|e| match e { + meilisearch_core::Error::IndexAlreadyExists => e.into(), + _ => ResponseError::from(Error::create_index(e)) + })?; let index_response = data.db.main_write::<_, _, ResponseError>(|mut writer| { let name = body.name.as_ref().unwrap_or(&uid);