Skip to content

Custom exception types via builtin_exception? #18

Answered by wjakob
inducer asked this question in Q&A
Discussion options

You must be logged in to vote

The best thing would be to port pybind11's exception translators to nanobind. The basic infrastructure is already in place: the internals data structure defined in src/internals.{h/cpp} provides a field

    std::vector<void (*)(const std::exception_ptr &)> exception_translators;

which is exactly the same in pybind11. One would simply have to hook this up to "user" (i.e., developer) code so that extra translators can be appended to the list.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@inducer
Comment options

Answer selected by inducer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants