Some fixes to error handling.

The fundamental issue was that exceptions could bubble up past the point where new error handlers were bound. The fix is to wrap thrown exceptions in a container that also provides the exchange.