error when deleting unexisting index

This commit is contained in:
mpostma 2020-06-05 11:33:59 +02:00
parent 32843e9ade
commit 11e00c906f

View File

@ -311,9 +311,11 @@ async fn delete_index(
data: web::Data<Data>,
path: web::Path<IndexParam>,
) -> Result<HttpResponse, ResponseError> {
data.db.delete_index(&path.index_uid)?;
if data.db.delete_index(&path.index_uid)? {
Ok(HttpResponse::NoContent().finish())
} else {
Err(Error::index_not_found(&path.index_uid).into())
}
}
#[derive(Deserialize)]