added logging in case error returned by API call