return an error when http code is not what we wanted