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
How do we feel about refactoring the current implementation of Exception?
Could we add a what method to the exception? It is required if pybind11 is to retrieve the underlying error message. This is as far as I can tell also idiomatic C++.
How do we feel about adding three subclasses: InputException InternalException RoutingExeption which hardcodes ERROR in their constructors? (Or perhaps deprecate the ERROR enum if it is no longer needed.) We then use the specific exceptions around in the codebase. It also works better on the Python side of things where the visual error representation is quite important.
An idea BTW that also is perhaps worth considering: Adding a unsigned exit_code attribute to the exception directly.
This way you can do:
Thanks for the suggestion. It would totally make sense to have dedicated subclasses for different kind of exceptions. I have the same feeling that in this case we could remove the ERROR enum altogether. Then removing the need for an external function to retrieve the code would also be much clearer.
Topic for discussion.
How do we feel about refactoring the current implementation of
Exception
?Could we add a
what
method to the exception? It is required ifpybind11
is to retrieve the underlying error message. This is as far as I can tell also idiomatic C++.How do we feel about adding three subclasses:
InputException InternalException RoutingExeption
which hardcodesERROR
in their constructors? (Or perhaps deprecate theERROR
enum if it is no longer needed.) We then use the specific exceptions around in the codebase. It also works better on the Python side of things where the visual error representation is quite important.An idea BTW that also is perhaps worth considering: Adding a
unsigned exit_code
attribute to the exception directly.This way you can do:
and you can replace:
get_code
then becomes obsolete and can be removed.The text was updated successfully, but these errors were encountered: