Types of Rethrown Exceptions
The type of exception that is rethrown by a runnable might not match the original exception class that was thrown or caught.
If the exception is based on the
RWTHRxmsg class, then the exception rethrown by
raise() is of the same class as the one captured.
Exceptions based on the
RWxmsg (or
xmsg) class are rethrown as an
RWxmsg with the same message value as the captured exception.
Any other type of exception is rethrown as an
RWTHRxmsg with a generic message stating that the captured exception was of an unrecognized type.
When designing code that you expect to execute inside a Threading package runnable, you might want to use the
RWTHRxmsg class as a base class for your exceptions. An exception derived from this class can be caught as an
RWTHRxmsg, copied for storage using a virtual
clone() function, and later “reconstituted” using a virtual
raise() function defined by the class. This
store-and-forward capability allows a runnable to capture and rethrow an exception.
The Threading package includes a template called
RWTTHRCompatibleException, which can convert an existing exception class into an
RWTHRxmsg-compatible exception.