Skip to content

Commit

Permalink
add title to error message if it exists
Browse files Browse the repository at this point in the history
  • Loading branch information
pnadolny13 committed Oct 2, 2024
1 parent b8f669a commit 6a49849
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tap_service_titan/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,23 @@ def parse_response(self, response: requests.Response) -> Iterable[dict]:
"""
yield from extract_jsonpath(self.records_jsonpath, input=response.json())

def response_error_message(self, response: requests.Response) -> str:
"""Build error message for invalid http statuses.
WARNING - Override this method when the URL path may contain secrets or PII
Args:
response: A :class:`requests.Response` object.
Returns:
str: The error message
"""
default = super().response_error_message(response)
if "title" in response.json():
title = response.json()["title"]
return f"{default}. {title}"
return default


class ServiceTitanExportStream(ServiceTitanBaseStream):
"""ServiceTitan stream class for export endpoints."""
Expand Down

0 comments on commit 6a49849

Please sign in to comment.