Improved exception catching during authentication