Catch exceptions in the client code that are thrown inside callbacks