airbytehq / airbyte

The leading data integration platform for ETL / ELT data pipelines from APIs, databases & files to data warehouses, data lakes & data lakehouses. Both self-hosted and Cloud-hosted.
https://airbyte.com
Other
16.29k stars 4.15k forks source link

[source-yandex] Add error details #42097

Open kodermax opened 4 months ago

kodermax commented 4 months ago

Topic

No response

Relevant information

could you add more details, what is available in this function does not work, because every time I get the message "Please check provided credentials"

Link: https://github.com/airbytehq/airbyte/blob/3cbd292154a8b8e942348e079404ae3a5146181c/airbyte-integrations/connectors/source-yandex-metrica/source_yandex_metrica/source.py#L28C24-L28C57

marcosmarxm commented 4 months ago

Thanks for reporting the issue @kodermax Yandex Metrica is a community connector and it isn’t in the current roadmap for improvements. If you want to contribute fixing the issue please reach me out in Slack so I can provide you instructions to make the contribution.

kodermax commented 4 months ago

@marcosmarxm I can't get into Slack, can we continue chatting here?

kodermax commented 4 months ago

@marcosmarxm you can add more detailed error handling, something like this:

 for stream in (session, views):
            try:
                result = stream.evaluate_logrequest()
                results.append(result)
            except RequestException as e:
                logger.error(f"Error during API request for {stream.__class__.__name__}: {str(e)}")
                return False, f"API request failed for {stream.__class__.__name__}: {str(e)}"
            except Exception as e:
                logger.error(f"Unexpected error for {stream.__class__.__name__}: {str(e)}")
                return False, f"Unexpected error occurred for {stream.__class__.__name__}: {str(e)}"

        if all(results):
            return True, None
        else:
            failed_streams = [stream.__class__.__name__ for stream, result in zip((session, views), results) if not result]
            return False, f"Connection check failed for: {', '.join(failed_streams)}"