Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix exception throwing #375

Merged
merged 3 commits into from
Mar 22, 2022
Merged

Fix exception throwing #375

merged 3 commits into from
Mar 22, 2022

Conversation

yoshoku
Copy link
Contributor

@yoshoku yoshoku commented Mar 21, 2022

This pull request fixes exception throwing. For example, this pull request changes make the error messages appropriate.

Currently release version:

>>> import hnswlib
>>> p = hnswlib.Index(space='foo', dim=8)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RuntimeError: Caught an unknown exception!
>>> p = hnswlib.Index(space='l2', dim=8)
>>> p.init_index(max_elements=8)
>>> p.init_index(max_elements=8)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RuntimeError: Caught an unknown exception!
>>>

Applying this pull request changes:

>>> import hnswlib
>>> p = hnswlib.Index(space='foo', dim=8)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RuntimeError: Space name must be one of l2, ip, or cosine.
>>> p = hnswlib.Index(space='l2', dim=8)
>>> p.init_index(max_elements=8)
>>> p.init_index(max_elements=8)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RuntimeError: The index is already initiated.
>>>

@yoshoku yoshoku marked this pull request as ready for review March 21, 2022 12:37
@yurymalkov yurymalkov changed the base branch from master to develop March 22, 2022 05:11
@yurymalkov
Copy link
Member

Thank you!

@yurymalkov yurymalkov merged commit eae971a into nmslib:develop Mar 22, 2022
@yoshoku yoshoku deleted the fix_errors branch March 22, 2022 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants