Over the weekend I wrote a small library to integrate failure with Python’s FFI support. It can currently:
- generate Python exception classes from the types defined in Rust
- check a FFI call into Rust for errors and raise the corresponding exception in Python
I think it’s already usable, but the API is quite rough (and unfinished) at the moment:
- there is no special Result-type to convert Result<T, failure::Error> into, mostly because I am not sure about the design yet.
- on the Rust-side, all types are created by a macro. That is because for some lib types, re-exporting external functions is not working.
- More warts are mentioned in the README
Any feedback is greatly appreciated.