Andy Carter
08/14/2023, 2:51 PMtiktok-business
tap API occasionally very occasionally returns a 'System Error' error code of 50000
for a reason I can't determine. The same call if retried later works fine. However the tap doesn't handle this at present, and happily stuffs the error code into my target as if it were a useful payload.
What SDK methods should I be looking at to introduce some error handling & retries in the tap code itself? Other SDK tap examples welcome too.Andy Carter
08/14/2023, 2:53 PMAndy Carter
08/14/2023, 2:58 PMedgar_ramirez_mondragon
08/14/2023, 4:45 PMdef validate_response(self, response):
super().validate_response() # The tap should still fail on 4xx and 5xx errors
data = response.json()
code = data["code"]
# handle the codes here, you can RetriableAPIError
if code == 50000:
raise RetriableAPIError(f"Encountered error {code}", response=response)
# check other codes
...