We can define exceptions in C++ and use in python using pybind11 as the link suggests: https://github.com/pybind/pybind11/blob/master/tests/test_exceptions.cpp The existing exceptions in C++ should be added to the python layer.