Generalized exception catching