diff --git a/airbyte_cdk/sources/file_based/availability_strategy/default_file_based_availability_strategy.py b/airbyte_cdk/sources/file_based/availability_strategy/default_file_based_availability_strategy.py index c9d416a72..9dea3a1a0 100644 --- a/airbyte_cdk/sources/file_based/availability_strategy/default_file_based_availability_strategy.py +++ b/airbyte_cdk/sources/file_based/availability_strategy/default_file_based_availability_strategy.py @@ -9,6 +9,7 @@ from typing import TYPE_CHECKING, Optional, Tuple from airbyte_cdk import AirbyteTracedException +from airbyte_cdk.models import FailureType from airbyte_cdk.sources import Source from airbyte_cdk.sources.file_based.availability_strategy import ( AbstractFileBasedAvailabilityStrategy, @@ -133,8 +134,10 @@ def _check_parse_record( except AirbyteTracedException as ate: raise ate except Exception as exc: - raise CheckAvailabilityError( - FileBasedSourceError.ERROR_READING_FILE, stream=stream.name, file=file.uri + raise AirbyteTracedException( + message=FileBasedSourceError.ERROR_READING_FILE.value, + internal_message=f"Error reading file {file.uri} in stream {stream.name}: {exc}", + failure_type=FailureType.system_error, ) from exc schema = stream.catalog_schema or stream.config.input_schema diff --git a/airbyte_cdk/sources/file_based/exceptions.py b/airbyte_cdk/sources/file_based/exceptions.py index cd727463a..5a2c96337 100644 --- a/airbyte_cdk/sources/file_based/exceptions.py +++ b/airbyte_cdk/sources/file_based/exceptions.py @@ -17,7 +17,7 @@ class FileBasedSourceError(Enum): ERROR_CASTING_VALUE_UNRECOGNIZED_TYPE = "Could not cast the value to the expected type because the type is not recognized. Valid types are null, array, boolean, integer, number, object, and string." ERROR_DECODING_VALUE = "Expected a JSON-decodeable value but could not decode record." ERROR_LISTING_FILES = "Error listing files. Please check the credentials provided in the config and verify that they provide permission to list files." - ERROR_READING_FILE = "Error opening file. Please check the credentials provided in the config and verify that they provide permission to read files." + ERROR_READING_FILE = "File read failed during availability check." ERROR_PARSING_RECORD = "Error parsing record. This could be due to a mismatch between the config's file type and the actual file type, or because the file or record is not parseable." ERROR_PARSING_USER_PROVIDED_SCHEMA = ( "The provided schema could not be transformed into valid JSON Schema."