You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Then users could catch the specific error thrown by the code (OutOfBoundsError), or use catch more general exception type (PolarsError).
Right now, I'm using the create_exception! macro to define the exceptions, as mentioned in the user guide. However, this does not allow for specifying a hierarchy.
I've found some discussion on subclassing exceptions:
...from this, it seems like my wish is already possible. However, I cannot find any code examples of how this is supposed to work. If it is already possible, could someone point me in the right direction? If not, consider this a feature request!
The text was updated successfully, but these errors were encountered:
This should definitely be possible and really this just needs proper documenting and testing, after which point I'd like to deprecate the create_exception! macro so we just have one blessed way of doing things.
I've opened #3475 which begins building such a test for an exception hierarchy, let's collaborate there to make sure that all the functionality you want is supported.
I'd like to be able to create an exception hierarchy in PyO3. In Python I would write something like:
Then users could catch the specific error thrown by the code (
OutOfBoundsError
), or use catch more general exception type (PolarsError
).Right now, I'm using the
create_exception!
macro to define the exceptions, as mentioned in the user guide. However, this does not allow for specifying a hierarchy.I've found some discussion on subclassing exceptions:
...from this, it seems like my wish is already possible. However, I cannot find any code examples of how this is supposed to work. If it is already possible, could someone point me in the right direction? If not, consider this a feature request!
The text was updated successfully, but these errors were encountered: