Catching exceptions in callbacks