Skip to content

Commit cc11666

Browse files
committed
chore: add stream_name to message
1 parent 7d7860e commit cc11666

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

airbyte_cdk/connector_builder/connector_builder_handler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,11 @@ def read_stream(
121121
# - internal_message: technical details for debugging (including config/catalog)
122122
error = AirbyteTracedException.from_exception(
123123
exc,
124-
message=filter_secrets(f"Error reading stream: {str(exc)}"),
124+
message=filter_secrets(f"Error reading stream {stream_name}: {str(exc)}"),
125125
)
126126
# Override internal_message to include context for debugging
127127
error.internal_message = filter_secrets(
128-
f"Error reading stream with config={config} and catalog={configured_catalog}: {str(exc)}"
128+
f"Error reading stream {stream_name} with config={config} and catalog={configured_catalog}: {str(exc)}"
129129
)
130130
return error.as_airbyte_message()
131131

unit_tests/connector_builder/test_connector_builder_handler.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,11 +1442,10 @@ def test_read_stream_error_message_does_not_contain_config_and_catalog():
14421442
# Mock the source
14431443
mock_source = MagicMock()
14441444

1445-
# Patch the handler to raise a meaningful exception
14461445
with patch(
14471446
"airbyte_cdk.connector_builder.test_reader.TestReader.run_test_read"
14481447
) as mock_handler:
1449-
# Simulate a common error like the datetime parsing error from the user's example
1448+
# Simulate a common error like a datetime parsing error
14501449
mock_handler.side_effect = ValueError("time data '' does not match format '%Y-%m-%dT%H:%M:%SZ'")
14511450

14521451
# Call the read_stream function
@@ -1463,15 +1462,14 @@ def test_read_stream_error_message_does_not_contain_config_and_catalog():
14631462
assert "__injected_declarative_manifest" not in user_message
14641463

14651464
# But it should contain the actual error
1466-
assert "time data" in user_message
1467-
assert "does not match format" in user_message
1465+
stream_name = catalog.streams[0].stream.name
1466+
assert user_message == f"Error reading stream {stream_name}: time data '' does not match format '%Y-%m-%dT%H:%M:%SZ'"
14681467

14691468
# The internal message should contain technical details for debugging
14701469
internal_message = response.trace.error.internal_message
14711470
assert "verbose_config_data" in internal_message
14721471
assert "verbose_catalog_schema" in internal_message
1473-
assert "Error reading stream with config=" in internal_message
1474-
assert "and catalog=" in internal_message
1472+
assert f"Error reading stream {stream_name} with config=" in internal_message
14751473

14761474

14771475
def test_full_resolve_manifest(valid_resolve_manifest_config_file):

0 commit comments

Comments
 (0)