making exception catching generic