Skip to content
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion airbyte_cdk/sources/file_based/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
Loading