Add test to handle exception