handle exception when request