Catch exceptions in callbacks.