Skip to content

Commit

Permalink
Add logs and handle possible issue with cleaning fields automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
hsyyid committed May 30, 2024
1 parent 26c08e9 commit 07a2cd4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/tap_intacct/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,15 +254,18 @@ def sync_stream(stream: str) -> None:
except SageIntacctSDKError as e:
# Get the error description
error = ast.literal_eval(e.message[7:])
logger.warn(f"Hit error when querying {stream}. Error: {error}")
result = error['response']['operation']['result']['errormessage']['error']['description2']
# Trim out the start and end of string message and then convert the neccessary elements into a list
result = result[70:(result.rfind("[")-1)].replace(" ", "").split(",")

# Remove any bad fields automatically
for field in result:
fields.remove(field)
# NOTE: Apparently this was failing because field was not in fields
if field in fields:
fields.remove(field)

# Make the request with the final fiedls
# Make the request with the final fields
data = Context.intacct_client.get_by_date(
object_type=stream,
fields=fields,
Expand Down

0 comments on commit 07a2cd4

Please sign in to comment.