Skip to content

Commit 5b6c307

Browse files
devin-ai-integration[bot]bot_apk
andauthored
fix: restore backward-compatible MessageRepresentationAirbyteTracedErrors alias (#976)
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: bot_apk <apk@cognition.ai>
1 parent 69cd63d commit 5b6c307

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

airbyte_cdk/sources/streams/http/http_client.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@
5858
)
5959
from airbyte_cdk.utils.traced_exception import AirbyteTracedException
6060

61+
# Backward-compatible deprecated alias. This class was removed in PR #927 but is still
62+
# imported by connectors in the airbyte monorepo. Keep as a simple alias to
63+
# AirbyteTracedException until all downstream usages have been migrated.
64+
MessageRepresentationAirbyteTracedErrors = AirbyteTracedException
65+
6166
BODY_REQUEST_METHODS = ("GET", "POST", "PUT", "PATCH")
6267

6368

unit_tests/sources/streams/http/test_http_client.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
RequestBodyException,
2626
UserDefinedBackoffException,
2727
)
28+
from airbyte_cdk.sources.streams.http.http_client import MessageRepresentationAirbyteTracedErrors
2829
from airbyte_cdk.sources.streams.http.requests_native_auth import TokenAuthenticator
2930
from airbyte_cdk.utils.traced_exception import AirbyteTracedException
3031

@@ -1059,3 +1060,17 @@ def update_response(*args, **kwargs):
10591060
assert mock_authenticator.access_token == "new_refreshed_token"
10601061
assert returned_response == valid_response
10611062
assert call_count == 2
1063+
1064+
1065+
def test_deprecated_alias_message_representation_airbyte_traced_errors_is_importable():
1066+
"""Verify that the deprecated alias still resolves to AirbyteTracedException."""
1067+
assert MessageRepresentationAirbyteTracedErrors is AirbyteTracedException
1068+
1069+
1070+
def test_deprecated_alias_is_catchable_as_airbyte_traced_exception():
1071+
"""Verify that exceptions raised as the alias can be caught as AirbyteTracedException."""
1072+
with pytest.raises(AirbyteTracedException):
1073+
raise MessageRepresentationAirbyteTracedErrors(
1074+
internal_message="test",
1075+
message="test user message",
1076+
)

0 commit comments

Comments
 (0)