Test for exception handling