I am not entirely happy with the current design. In particular I don't like the fact that it requires user registered exception translators to always catch all exceptions. If they forget, it breaks the exception translation chain and goes immediately to the default translator. This can in particular be a problem when exception translators are registered by multiple different (potentially external) packages. I have now added an alternative design on a separate branch (tickets/
This design makes the default handing into just another exception translator which is always tried last. With this design user registered translators are no longer required to always catch all exceptions (which they may forget to do, breaking the exception translation chain). Instead they should only catch those exceptions they actually translate, leaving the rest to the next registered translator.
A downside of this design is that the exception handling code in pybind11 itself is perhaps less readable.
Although the current code is already marked as reviewed, I still think it is important to think about it a bit more. Especially since it will be hard to change once it is upstream. So Jim Bosch if you have time, please have a look and tell me what you think.