throw an exception with api error