CB 964

Consolidated some error handling in callbacks, and fire a document event when an error occurs.