More accurate test on exception handling