From 1437b1ef989479f7c3036c8ed853de6787435393 Mon Sep 17 00:00:00 2001 From: Peter Sobot Date: Tue, 23 Mar 2021 09:32:28 -0400 Subject: [PATCH] Throw an exception if passed an unrecognized space_name. --- python_bindings/bindings.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python_bindings/bindings.cpp b/python_bindings/bindings.cpp index 93b79a60..cc481b3e 100644 --- a/python_bindings/bindings.cpp +++ b/python_bindings/bindings.cpp @@ -97,6 +97,8 @@ class Index { else if(space_name=="cosine") { l2space = new hnswlib::InnerProductSpace(dim); normalize=true; + } else { + throw new std::runtime_error("Space name must be one of l2, ip, or cosine."); } appr_alg = NULL; ep_added = true;