Skip to content

Commit

Permalink
✨ Source Amazon Seller Partner: Add logs for the failed check command (
Browse files Browse the repository at this point in the history
  • Loading branch information
tolik0 authored and jatinyadav-cc committed Feb 26, 2024
1 parent 39bf7cd commit 5fca594
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ data:
connectorSubtype: api
connectorType: source
definitionId: e55879a8-0ef8-4557-abcf-ab34c53ec460
dockerImageTag: 3.3.0
dockerImageTag: 3.3.1
dockerRepository: airbyte/source-amazon-seller-partner
documentationUrl: https://docs.airbyte.com/integrations/sources/amazon-seller-partner
githubIssueLabel: source-amazon-seller-partner
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#


import traceback
from os import getenv
from typing import Any, List, Mapping, Optional, Tuple

Expand All @@ -11,6 +12,7 @@
from airbyte_cdk.models import SyncMode
from airbyte_cdk.sources import AbstractSource
from airbyte_cdk.sources.streams import Stream
from airbyte_cdk.utils import AirbyteTracedException
from requests import HTTPError
from source_amazon_seller_partner.auth import AWSAuthenticator
from source_amazon_seller_partner.constants import get_marketplaces
Expand Down Expand Up @@ -124,8 +126,11 @@ def check_connection(self, logger: AirbyteLogger, config: Mapping[str, Any]) ->
if isinstance(e, StopIteration):
return True, None

error_message = e.response.json().get("error_description") if isinstance(e, HTTPError) else e
return False, error_message
if isinstance(e, HTTPError):
return False, e.response.json().get("error_description")
else:
error_message = "Caught unexpected exception during the check"
raise AirbyteTracedException(internal_message=error_message, message=error_message, exception=e)

def streams(self, config: Mapping[str, Any]) -> List[Stream]:
"""
Expand Down
Loading

0 comments on commit 5fca594

Please sign in to comment.