python-bindings
python-bindings copied to clipboard
Support preCICE Exception system
In https://github.com/precice/precice/pull/1594 we are currently introducing an exception system for preCICE. We should also support this in the python bindings.
Some necessary steps that I see here:
- [ ] Cython has some support for C++ Exception, but we need to explicitly state that certain functions may throw an exception. For details see https://cython.readthedocs.io/en/latest/src/userguide/wrapping_CPlusPlus.html#exceptions.
- [ ] Start with a single base exception
precice.Error - [ ] Define our own exception system for more fine-grained errors (basically map thrown C++ preCICE exceptions to python exceptions). We should use larger python Frameworks as a template here (numpy, for example, also defines its own exceptions)
- [ ] We should also make sure to be able to catch unknown exceptions (imagine C++ preCICE introduces a
FooErrorupstream, then we want to at least raise a genericprecice.Errorhere until we implementprecice.FooError) - [ ] We should also add (some) tests for error handling. I think we can simply extend our mocked version of preCICE with some dummy exceptions and explicitly test for them to make sure that passing the error generally works.
As soon as https://github.com/precice/precice/pull/2065 is merged we should be able to start working on this issue.