Skip to content
This repository has been archived by the owner on Mar 11, 2023. It is now read-only.


Folders and files

Last commit message
Last commit date

Latest commit



56 Commits

Repository files navigation


failure in other languages

Travis PyPI

Shippai is a set of libraries that help you with handling failure-style errors from other languages

Right now this project consists of:

  • A Rust library to generate FFI code for your Fail types.

  • A Python library to:

    1. generate exception types from the information provided by that FFI
    2. convert errors passed through that interface into a corresponding exception and raise them together with a complete stacktrace


Check out the Python example for a rough idea of how it all plays together. Here is how a stacktrace looks like:

$ make install-dev
Python 3.6.5 (default, May 11 2018, 04:00:52)
[GCC 8.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import shippai_example
>>> shippai_example.authenticate('', '')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/untitaker/projects/shippai/examples/python/shippai_example/", line 25, in authenticate
  File "/home/untitaker/projects/shippai/python/shippai/", line 144, in check_exception
    _raise_with_more_frames(exc, frames)
  File "/home/untitaker/projects/shippai/python/shippai/", line 262, in _raise_with_more_frames
    _append_frame(exc_info, frames[-1])
  File "/home/untitaker/projects/shippai/python/shippai/", line 296, in _append_frame
    exec(code, ns)
  File "/home/untitaker/projects/shippai/examples/python/rust/src/", line 43, in authenticate
    let res = authenticate_impl(
  File "/home/untitaker/projects/shippai/examples/python/rust/src/", line 27, in shippai_example::authenticate_impl::he2a2e071e069a869
    return Err(MyError::UserWrong.into());
  File "/checkout/src/libcore/", line 396, in <T as core::convert::Into<U>>::into::hda623f1239c06654
shippai.UserWrong: Invalid username


Shippai is a work-in-progress, a lot of features are missing. (check the issue tracker)

I also have no idea what I am doing. If you see funny code here (particularly in the FFI parts), don't assume it is because of a good reason. Tell me where I am wrong.


Shippai is licensed under MIT, see LICENSE.