Skip to content

Commit e74d936

Browse files
authored
CDK: updated error message for missing streams (#36833)
1 parent 9cd72c3 commit e74d936

File tree

5 files changed

+439
-337
lines changed

5 files changed

+439
-337
lines changed

airbyte-cdk/python/airbyte_cdk/sources/abstract_source.py

+10-3
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,16 @@ def read(
113113
if not stream_instance:
114114
if not self.raise_exception_on_missing_stream:
115115
continue
116-
raise KeyError(
117-
f"The stream {configured_stream.stream.name} no longer exists in the configuration. "
118-
f"Refresh the schema in replication settings and remove this stream from future sync attempts."
116+
117+
error_message = (
118+
f"The stream '{configured_stream.stream.name}' in your connection configuration was not found in the source. "
119+
f"Refresh the schema in your replication settings and remove this stream from future sync attempts."
120+
)
121+
122+
raise AirbyteTracedException(
123+
message="A stream listed in your configuration was not found in the source. Please check the logs for more details.",
124+
internal_message=error_message,
125+
failure_type=FailureType.config_error,
119126
)
120127

121128
try:

airbyte-cdk/python/airbyte_cdk/sources/concurrent_source/concurrent_source_adapter.py

+13-4
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55
from abc import ABC
66
from typing import Any, Iterator, List, Mapping, MutableMapping, Optional, Union
77

8-
from airbyte_cdk.models import AirbyteMessage, AirbyteStateMessage, ConfiguredAirbyteCatalog
8+
from airbyte_cdk.models import AirbyteMessage, AirbyteStateMessage, ConfiguredAirbyteCatalog, FailureType
99
from airbyte_cdk.sources import AbstractSource
1010
from airbyte_cdk.sources.concurrent_source.concurrent_source import ConcurrentSource
1111
from airbyte_cdk.sources.streams import Stream
1212
from airbyte_cdk.sources.streams.concurrent.abstract_stream import AbstractStream
1313
from airbyte_cdk.sources.streams.concurrent.abstract_stream_facade import AbstractStreamFacade
14+
from airbyte_cdk.utils.traced_exception import AirbyteTracedException
1415

1516

1617
class ConcurrentSourceAdapter(AbstractSource, ABC):
@@ -54,10 +55,18 @@ def _select_abstract_streams(self, config: Mapping[str, Any], configured_catalog
5455
if not stream_instance:
5556
if not self.raise_exception_on_missing_stream:
5657
continue
57-
raise KeyError(
58-
f"The stream {configured_stream.stream.name} no longer exists in the configuration. "
59-
f"Refresh the schema in replication settings and remove this stream from future sync attempts."
58+
59+
error_message = (
60+
f"The stream '{configured_stream.stream.name}' in your connection configuration was not found in the source. "
61+
f"Refresh the schema in your replication settings and remove this stream from future sync attempts."
62+
)
63+
64+
raise AirbyteTracedException(
65+
message="A stream listed in your configuration was not found in the source. Please check the logs for more details.",
66+
internal_message=error_message,
67+
failure_type=FailureType.config_error,
6068
)
69+
6170
if isinstance(stream_instance, AbstractStreamFacade):
6271
abstract_streams.append(stream_instance.get_underlying_stream())
6372
return abstract_streams

0 commit comments

Comments
 (0)