Catch exceptions thrown from callback.