1.3 Callback Error Handling

Any attempt to execute the run method on a threadable object can result in an exception being thrown. This is to be expected, as bad things do happen and exceptions are the correct way of dealing with such an eventuality. The problem with throwing an exception in this context is that information about the exception condition needs to be propagated back to the application so that it can take the appropriate action. This is solved by extending the application's callback interface as shown in Listing 1.4.

% latex2html id marker 103\begin{small}
\end{small}\caption{A Basic Deferrable Interface Definition}

Again, this is a basic version of the interface definition which is used to define callbacks for the Reaction framework. As well as the original callback method, the onErrback method has been added which may be used for passing back exception conditions detected while executing a threadable object. In keeping with the name of the extended interface, objects which implement Deferrable are subsequently referred to as deferrable objects.