python-bindings icon indicating copy to clipboard operation
python-bindings copied to clipboard

Support preCICE Exception system

Open BenjaminRodenberg opened this issue 2 years ago • 1 comments

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 FooError upstream, then we want to at least raise a generic precice.Error here until we implement precice.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.

BenjaminRodenberg avatar Mar 09 '23 07:03 BenjaminRodenberg

As soon as https://github.com/precice/precice/pull/2065 is merged we should be able to start working on this issue.

BenjaminRodenberg avatar Aug 20 '24 13:08 BenjaminRodenberg