Skip to content

Commit 57c269d

Browse files
Source github: improve error logging (#16947)
* #410 oncall source github: improve error logging * source github: upd changelog * auto-bump connector version [ci skip] Co-authored-by: Octavia Squidington III <[email protected]>
1 parent 59a699b commit 57c269d

File tree

6 files changed

+382
-139
lines changed

6 files changed

+382
-139
lines changed

airbyte-config/init/src/main/resources/seed/source_definitions.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@
331331
- name: GitHub
332332
sourceDefinitionId: ef69ef6e-aa7f-4af1-a01d-ef775033524e
333333
dockerRepository: airbyte/source-github
334-
dockerImageTag: 0.3.0
334+
dockerImageTag: 0.3.1
335335
documentationUrl: https://docs.airbyte.io/integrations/sources/github
336336
icon: github.svg
337337
sourceType: api

airbyte-config/init/src/main/resources/seed/source_specs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3166,7 +3166,7 @@
31663166
supportsNormalization: false
31673167
supportsDBT: false
31683168
supported_destination_sync_modes: []
3169-
- dockerImage: "airbyte/source-github:0.3.0"
3169+
- dockerImage: "airbyte/source-github:0.3.1"
31703170
spec:
31713171
documentationUrl: "https://docs.airbyte.com/integrations/sources/github"
31723172
connectionSpecification:

airbyte-integrations/connectors/source-github/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ RUN pip install .
1212
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
1313
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]
1414

15-
LABEL io.airbyte.version=0.3.0
15+
LABEL io.airbyte.version=0.3.1
1616
LABEL io.airbyte.name=airbyte/source-github

airbyte-integrations/connectors/source-github/source_github/streams.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ def read_records(self, stream_slice: Mapping[str, Any] = None, **kwargs) -> Iter
115115
try:
116116
yield from super().read_records(stream_slice=stream_slice, **kwargs)
117117
except HTTPError as e:
118-
error_msg = str(e.response.json().get("message"))
119118
# This whole try/except situation in `read_records()` isn't good but right now in `self._send_request()`
120119
# function we have `response.raise_for_status()` so we don't have much choice on how to handle errors.
121120
# Bocked on https://github.com/airbytehq/airbyte/issues/3514.
@@ -128,6 +127,7 @@ def read_records(self, stream_slice: Mapping[str, Any] = None, **kwargs) -> Iter
128127
else:
129128
error_msg = f"Syncing `{self.__class__.__name__}` stream isn't available for repository `{stream_slice['repository']}`."
130129
elif e.response.status_code == requests.codes.FORBIDDEN:
130+
error_msg = str(e.response.json().get("message"))
131131
# When using the `check_connection` method, we should raise an error if we do not have access to the repository.
132132
if isinstance(self, Repositories):
133133
raise e
@@ -153,7 +153,8 @@ def read_records(self, stream_slice: Mapping[str, Any] = None, **kwargs) -> Iter
153153
f"`{stream_slice['repository']}`, it seems like this repository is empty."
154154
)
155155
else:
156-
self.logger.error(f"Undefined error while reading records: {error_msg}")
156+
# most probably here we're facing a 500 server error and a risk to get a non-json response, so lets output response.text
157+
self.logger.error(f"Undefined error while reading records: {e.response.text}")
157158
raise e
158159

159160
self.logger.warn(error_msg)

0 commit comments

Comments
 (0)