Skip to content

radex Exceptions - #38

Merged
ashao merged 6 commits into
mainfrom
custom-exceptions
Aug 21, 2026
Merged

radex Exceptions#38
ashao merged 6 commits into
mainfrom
custom-exceptions

Conversation

@ashao

@ashao ashao commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

Define and throw better exceptions other than the standard runtime errors. These are then wired up to the Python client by mirroring the exceptions between the C++ definitions and a separate Python one.

@MattToast
MattToast self-requested a review August 21, 2026 21:10

@MattToast MattToast left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to try changing the location of one import statement really quick, but otherwise this seems to make sense to me.

LGTM!! Thanks for helping cleanup the unhappy error path!!

if n_dims == 0:
# TODO: Better error type/msg here
raise ValueError("Attempted to retrieve vector at a key with a scalar")
from radex.exceptions import RankMismatchError

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might be able to move this and the import at line 73 into a top level

from radex.exceptions import RankMismatchError

as I don't think that radex.exceptions uses anything from this module and therefor we do not need to guard against the circular import.

That said, I'm not entirely sure how will this will play nice with the Cython compile step. It might be worth a shot, but if it doesn't work immediately feel free to ignore this comment.

Comment thread src/python/setup.py Outdated
ashao and others added 3 commits August 21, 2026 14:48
Co-authored-by: Matt Drozt <matthew.drozt@gmail.com>
This reverts commit 1af7e82.
@ashao
ashao merged commit 18c30c3 into main Aug 21, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants