Properly handle exception