diff --git a/src/tap_intacct/client.py b/src/tap_intacct/client.py index d1e8d4c..d262194 100644 --- a/src/tap_intacct/client.py +++ b/src/tap_intacct/client.py @@ -217,11 +217,14 @@ def _post_request(self, dict_body: dict, api_url: str) -> Dict: if api_response['result']['status'] == 'success': return api_response + logger.error(f"Intacct error response: {api_response}") + error = api_response.get('result', {}).get('errormessage', {}).get('error', {}) + desc_2 = error.get("description2") if isinstance(error, dict) else error[0].get("description2") if isinstance(error, list) and error else "" if ( api_response['result']['status'] == 'failure' - and api_response.get('result', {}).get('errormessage', {}).get('error', {}).get('description2') + and error and "There was an error processing the request" - in api_response['result']['errormessage']['error']['description2'] + in desc_2 and dict_body["request"]["operation"]["content"]["function"]["query"][ "object" ]