The process of handling exception conditions within a callback chain is similar to conventional callback chaining. Error conditions are passed up the callback chain by throwing exceptions from within the deferrable callback handler's onErrback method, as shown in Listing 5.12.
On calling the onErrback method on a given deferrable callback handler, the deferred event object passes the exception condition which was thrown by the previous stage in the callback chain. In the example implementation the exception is simply re-thrown at each stage. Generally speaking, the error condition should always be dealt with by the terminal deferrable, since unhandled error conditions at this position in the callback chain will effectively be `lost'. Listing 5.13 demonstrates the way in which such unhandled error conditions are reported to the reactor log as warning messages. The full code for this example is included in the deferred examples package as DeferredChainExample2.