I wasn't quite sure how you were handling this in general.  The C code sets the why value to WHY_EXCEPTION and raises an exception.  I was wondering if it makes sense to make the why code an attribute of the object.