Recall Subsection 11.2.3 discussed issues associated with support for SIDL exceptions. Below is an example snippet of code for throwing the exceptions that are caught in the Subsection 11.3.7 example. The setNote method provides a useful error message, and the add method helps provide a multi-language traceback capability -- provided each layer of the call stack calls add.
def getFib(self, n, max_depth, max_value, depth): # sidl EXPECTED INCOMING TYPES # ============================ # int n, max_depth, max_value, depth # # sidl EXPECTED RETURN VALUE(s) # ============================= # int _return # DO-NOT-DELETE splicer.begin(getFib) if (n < 0): ex = ExceptionTest.NegativeValueException.NegativeValueException() ex.setNote("n negative") ex.add(__name__, 0, "ExceptionTest.Fib.getFib") raise ExceptionTest.NegativeValueException._Exception, ex # numerous lines deleted # DO-NOT-DELETE splicer.end(getFib)