The `tiktok-business` tap API occasionally very oc...
# singer-tap-development
a
The
tiktok-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.
message has been deleted
e
I think you want to override validate_response, along with RetriableAPIError:
Copy code
def 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
  ...