handle xhr errors