Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions airbyte_cdk/sources/streams/http/http_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@
)
from airbyte_cdk.utils.traced_exception import AirbyteTracedException

# Backward-compatible deprecated alias. This class was removed in PR #927 but is still
# imported by connectors in the airbyte monorepo. Keep as a simple alias to
# AirbyteTracedException until all downstream usages have been migrated.
MessageRepresentationAirbyteTracedErrors = AirbyteTracedException

BODY_REQUEST_METHODS = ("GET", "POST", "PUT", "PATCH")


Expand Down
15 changes: 15 additions & 0 deletions unit_tests/sources/streams/http/test_http_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
RequestBodyException,
UserDefinedBackoffException,
)
from airbyte_cdk.sources.streams.http.http_client import MessageRepresentationAirbyteTracedErrors
from airbyte_cdk.sources.streams.http.requests_native_auth import TokenAuthenticator
from airbyte_cdk.utils.traced_exception import AirbyteTracedException

Expand Down Expand Up @@ -1059,3 +1060,17 @@ def update_response(*args, **kwargs):
assert mock_authenticator.access_token == "new_refreshed_token"
assert returned_response == valid_response
assert call_count == 2


def test_deprecated_alias_message_representation_airbyte_traced_errors_is_importable():
"""Verify that the deprecated alias still resolves to AirbyteTracedException."""
assert MessageRepresentationAirbyteTracedErrors is AirbyteTracedException


def test_deprecated_alias_is_catchable_as_airbyte_traced_exception():
"""Verify that exceptions raised as the alias can be caught as AirbyteTracedException."""
with pytest.raises(AirbyteTracedException):
raise MessageRepresentationAirbyteTracedErrors(
internal_message="test",
message="test user message",
)
Loading