Fix Version/s: None
Sprint:DRP F16-1, DRP F16-2
Team:Data Release Production
Pybind11 does not currently support translation of custom exceptions. This ticket tracks work done on upstream pybind11 (internal fork https://github.com/lsst-dm/pybind11-1) to implement this functionality. It should support functionality equivalent to (but not necessarily with the same API) as Boost Python exception translators (http://www.boost.org/doc/libs/1_61_0/libs/python/doc/html/reference/high_level_components/boost_python_exception_translato.html).
- is child task of
DM-6302 Wrap pex_exceptions with pybind11
SP look fine (if anything a bit on the high end). I will! Although I think I remember telling you I was going to put this in as a 0 point story and assume the SP were contained by its parent
When an exception is caught, give each registered exception translator a chance to translate it to a Python exception in reverse order of registration.
A translator may choose to do one of the following:
- catch the exception and call PyErr_SetString or PyErr_SetObject to set a standard (or custom) Python exception, or
- do nothing and let the exception fall through to the next translator, or
- delegate translation to the next translator by throwing a new type of exception.
The last point is a little tricky, and breaks the ability to mentally view the set of translators as a single block of catch clauses. But it is what Boost does (or seems to do) and may be necessary
to avoid code duplication.
Have sent a link to this version to the pybind11 developers. Will now wait for their feedback.
Assuming the design holds up I intend to use it for
DM-6302 and formally it upstream if this suffices.
Received very positive feedback on the latest design from the lead pybind11 developer.
He is keen to accept the code.
I propose we will attempt
DM-6302 with this solution and close this ticket when the design works and is accepted upstream.
Pim Schellart [X] – I've added an entirely speculative SP count to this story. Please update it to something you think is more reasonable. (Bonus points if you remember to put in SP estimates before starting work in future! )