API Reference¶
Everything on this page is generated directly from the docstrings and type annotations in the source, so it always matches the installed version.
Top-level package¶
The names below are re-exported from dataexcept itself, so
from dataexcept import ValidationError works without reaching into a
submodule.
dataexcept ¶
Top-level package for DataExcept.
Every exception the package defines is importable straight from here::
from dataexcept import ValidationError, ModelTrainingError
They all derive from :class:DataExceptError, so one clause catches every
operational exception this package raises::
except DataExceptError:
...
The domain modules (datascience_exceptions, pipeline_exceptions and so
on) remain importable and export the same objects, so both spellings work and
refer to the same classes.
DataExceptError ¶
Bases: Exception
Base class for every operational exception DataExcept raises.
Source code in dataexcept/base.py
UnpicklableCause ¶
Bases: DataExceptError
Stands in for a cause that could not be serialized.
__cause__ and __context__ must be exceptions, so the placeholder
used for ordinary attributes will not do here. Dropping the chain instead
would silently lose the reason for the failure.
Source code in dataexcept/base.py
UnpicklableValue ¶
Stands in for state that could not survive serialization.
An exception carrying a lambda, an open file or a lock would otherwise be unraisable across a process boundary. Keeping a description preserves what the value was for debugging, which is the reason it was attached.
Source code in dataexcept/base.py
DatabaseConnectionError ¶
Bases: DatabaseError
Raised when connecting to the database fails.
Source code in dataexcept/database_exceptions.py
DatabaseError ¶
Bases: DataExceptError
Base exception for database-related errors.
Source code in dataexcept/database_exceptions.py
QueryExecutionError ¶
Bases: DatabaseError
Raised when a database query execution fails.
Source code in dataexcept/database_exceptions.py
TransactionError ¶
Bases: DatabaseError
Raised when a database transaction fails.
Source code in dataexcept/database_exceptions.py
BatchProcessingError ¶
Bases: DataEngineeringError
Raised when processing a data batch fails.
Source code in dataexcept/dataengineering_exceptions.py
DataEngineeringError ¶
Bases: DataExceptError
Base exception for data engineering errors.
Source code in dataexcept/dataengineering_exceptions.py
DataTransformationError ¶
Bases: DataEngineeringError
Raised when a data transformation step fails.
Source code in dataexcept/dataengineering_exceptions.py
DataWarehouseConnectionError ¶
Bases: DataEngineeringError
Raised when a connection to a data warehouse cannot be established.
Source code in dataexcept/dataengineering_exceptions.py
ETLJobError ¶
Bases: DataEngineeringError
Raised when an ETL job fails to complete successfully.
Source code in dataexcept/dataengineering_exceptions.py
MissingPartitionError ¶
Bases: DataEngineeringError
Raised when a required data partition is missing.
Source code in dataexcept/dataengineering_exceptions.py
SchemaEvolutionError ¶
Bases: DataEngineeringError
Raised when database schema evolution fails.
Source code in dataexcept/dataengineering_exceptions.py
BiasDetectionError ¶
Bases: DataScienceError
Raised when algorithmic bias exceeds an acceptable threshold.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
feature
|
str
|
Feature or group where bias was detected. |
required |
bias_score
|
float
|
Calculated bias metric. |
required |
threshold
|
float
|
Maximum acceptable bias metric. |
required |
message
|
Optional[str]
|
Optional custom message. |
None
|
Source code in dataexcept/datascience_exceptions/training.py
ConvergenceError ¶
Bases: ModelTrainingError
Raised when optimization fails to converge.
Attributes:
| Name | Type | Description |
|---|---|---|
iterations |
number of iterations run. |
Source code in dataexcept/datascience_exceptions/training.py
CrossValidationError ¶
Bases: DataScienceError
Failure during cross-validation procedure.
Source code in dataexcept/datascience_exceptions/training.py
DataAugmentationError ¶
Bases: DataScienceError
Raised when a data augmentation technique fails.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
technique
|
str
|
Name of the augmentation technique. |
required |
details
|
Optional[str]
|
Optional explanation of the failure. |
None
|
Source code in dataexcept/datascience_exceptions/ingestion.py
DataDriftError ¶
Bases: DataScienceError
Raised when data drift is detected beyond threshold.
Attributes:
| Name | Type | Description |
|---|---|---|
feature |
feature name. |
|
drift_score |
computed drift metric. |
Source code in dataexcept/datascience_exceptions/operations.py
DataExportError ¶
Bases: DataScienceError
Failed to export or write data to destination.
Source code in dataexcept/datascience_exceptions/operations.py
DataFormatError ¶
Bases: DataScienceError
Raised when input data is not in the expected format.
Source code in dataexcept/datascience_exceptions/ingestion.py
DataImbalanceError ¶
Bases: DataScienceError
Raised when class distribution is too imbalanced.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ratio
|
float
|
Observed minority-to-majority ratio. |
required |
threshold
|
float
|
Minimum acceptable ratio. |
required |
message
|
Optional[str]
|
Optional custom error message. |
None
|
Source code in dataexcept/datascience_exceptions/ingestion.py
DataLeakageError ¶
Bases: DataScienceError
Raised when data leakage is detected between train and test sets.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
feature
|
str
|
Name of the leaked feature. |
required |
stage
|
str
|
Stage where the leakage occurred. |
required |
message
|
Optional[str]
|
Optional custom message. |
None
|
Source code in dataexcept/datascience_exceptions/ingestion.py
DataLoadingError ¶
Bases: DataScienceError
Raised when loading data fails.
Attributes:
| Name | Type | Description |
|---|---|---|
source |
data source description (file path, URL). |
|
original |
underlying exception. |
Source code in dataexcept/datascience_exceptions/ingestion.py
DataNormalizationError ¶
Bases: DataScienceError
Raised when data normalization fails.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
method
|
str
|
Normalization technique identifier. |
required |
details
|
Optional[str]
|
Optional explanation of the failure. |
None
|
Source code in dataexcept/datascience_exceptions/ingestion.py
DataScienceError ¶
Bases: DataExceptError
Base exception for data science errors.
Source code in dataexcept/datascience_exceptions/base.py
DataValidationError ¶
Bases: DataScienceError
Raised when data fails validation rules.
Attributes:
| Name | Type | Description |
|---|---|---|
field |
name of invalid field. |
|
value |
the invalid value. |
Source code in dataexcept/datascience_exceptions/ingestion.py
DeploymentError ¶
Bases: DataScienceError
Raised when deploying a model or pipeline fails.
Attributes:
| Name | Type | Description |
|---|---|---|
target |
deployment target identifier. |
|
cause |
optional detail. |
Source code in dataexcept/datascience_exceptions/operations.py
DimensionalityReductionError ¶
Bases: DataScienceError
Error applying dimensionality reduction method.
Source code in dataexcept/datascience_exceptions/training.py
EarlyStoppingError ¶
Bases: DataScienceError
Raised when training stops early based on a stopping criterion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
epoch
|
int
|
Epoch index where training stopped. |
required |
reason
|
Optional[str]
|
Optional reason for stopping. |
None
|
Source code in dataexcept/datascience_exceptions/training.py
ExperimentTrackingError ¶
Bases: DataScienceError
Issues logging or retrieving experiment metadata.
Source code in dataexcept/datascience_exceptions/training.py
ExplainabilityError ¶
Bases: DataScienceError
Raised when generating model explanations fails.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
method
|
str
|
Explanation technique identifier. |
required |
details
|
Optional[str]
|
Optional description of the failure. |
None
|
Source code in dataexcept/datascience_exceptions/training.py
FeatureEngineeringError ¶
Bases: DataScienceError
Raised during feature engineering steps.
Attributes:
| Name | Type | Description |
|---|---|---|
step |
description of the step that failed. |
|
cause |
optional underlying reason. |
Source code in dataexcept/datascience_exceptions/ingestion.py
FeatureScalingError ¶
Bases: DataScienceError
Raised when scaling or standardization of features fails.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scaler
|
str
|
Name of the scaler or transformation used. |
required |
details
|
Optional[str]
|
Optional explanation of the failure. |
None
|
Source code in dataexcept/datascience_exceptions/training.py
FeatureSelectionError ¶
Bases: DataScienceError
Failure in feature selection procedure.
Source code in dataexcept/datascience_exceptions/training.py
GPUOutOfMemoryError ¶
Bases: DataScienceError
Model or tensor exceeds GPU memory capacity.
Source code in dataexcept/datascience_exceptions/training.py
HyperparameterError ¶
Bases: DataScienceError
Raised for invalid hyperparameter settings.
Attributes:
| Name | Type | Description |
|---|---|---|
param |
name of hyperparameter. |
|
value |
invalid value. |
Source code in dataexcept/datascience_exceptions/training.py
HyperparameterTuningError ¶
Bases: DataScienceError
Error during hyperparameter search or tuning.
Source code in dataexcept/datascience_exceptions/training.py
MissingDataError ¶
Bases: DataScienceError
Raised when required data is missing.
Attributes:
| Name | Type | Description |
|---|---|---|
feature |
name of missing feature. |
Source code in dataexcept/datascience_exceptions/ingestion.py
ModelCompatibilityError ¶
Bases: DataScienceError
Raised when a model is incompatible with the runtime environment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
expected_version
|
str
|
Required model version. |
required |
found_version
|
str
|
Detected model version. |
required |
message
|
Optional[str]
|
Optional custom message. |
None
|
Source code in dataexcept/datascience_exceptions/training.py
ModelEvaluationError ¶
Bases: DataScienceError
Raised during evaluation metrics computation.
Attributes:
| Name | Type | Description |
|---|---|---|
metric |
name of the metric. |
|
value |
computed value. |
Source code in dataexcept/datascience_exceptions/training.py
ModelInferenceError ¶
Bases: DataScienceError
Raised when model inference fails.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_type
|
str
|
Identifier of the model used for inference. |
required |
original
|
Exception
|
Underlying exception raised by the model. |
required |
Source code in dataexcept/datascience_exceptions/training.py
ModelSerializationError ¶
Bases: DataScienceError
Raised when saving or loading a model fails.
Attributes:
| Name | Type | Description |
|---|---|---|
path |
file path involved. |
|
original |
underlying exception. |
Source code in dataexcept/datascience_exceptions/operations.py
ModelTrainingError ¶
Bases: DataScienceError
Raised when model training fails.
Attributes:
| Name | Type | Description |
|---|---|---|
model_type |
model class or name. |
|
epoch |
optional epoch index. |
Source code in dataexcept/datascience_exceptions/training.py
OutlierDetectionError ¶
Bases: DataScienceError
Raised when outlier detection fails.
Attributes:
| Name | Type | Description |
|---|---|---|
method |
detection method name. |
|
details |
optional extra info. |
Source code in dataexcept/datascience_exceptions/ingestion.py
OverfittingError ¶
Bases: DataScienceError
Raised when a model is overfitting the training data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
train_metric
|
float
|
Metric value on the training set. |
required |
val_metric
|
float
|
Metric value on the validation set. |
required |
Source code in dataexcept/datascience_exceptions/training.py
PredictionError ¶
Bases: DataScienceError
Raised when making predictions fails.
Attributes:
| Name | Type | Description |
|---|---|---|
model_type |
model used. |
|
inputs |
input data snapshot. |
Source code in dataexcept/datascience_exceptions/training.py
ResourceLimitError ¶
Bases: DataScienceError
Raised when computation exceeds resources (memory, CPU).
Attributes:
| Name | Type | Description |
|---|---|---|
resource |
'memory', 'cpu', etc. |
|
limit |
threshold exceeded. |
Source code in dataexcept/datascience_exceptions/operations.py
SchemaMismatchError ¶
Bases: DataScienceError
Raised when data schema does not match expected.
Attributes:
| Name | Type | Description |
|---|---|---|
expected |
expected schema description. |
|
found |
actual schema description. |
Source code in dataexcept/datascience_exceptions/ingestion.py
TrainingTimeoutError ¶
Bases: ModelTrainingError
Raised when model training exceeds a time limit.
Source code in dataexcept/datascience_exceptions/training.py
UnderfittingError ¶
Bases: DataScienceError
Raised when a model fails to capture patterns in the data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
train_metric
|
float
|
Metric value on the training set. |
required |
threshold
|
float
|
Minimum acceptable metric value. |
required |
Source code in dataexcept/datascience_exceptions/training.py
AuthenticationError ¶
Bases: JobError
Raised when user authentication fails.
Source code in dataexcept/exceptions/authentication.py
AuthorizationError ¶
Bases: JobError
Raised when user lacks permission for an action.
Source code in dataexcept/exceptions/authentication.py
ConfigurationError ¶
Bases: JobError
Raised when there is a problem with configuration or settings.
Source code in dataexcept/exceptions/configuration.py
CronExpressionError ¶
Bases: JobError
Raised when a cron expression is invalid.
Source code in dataexcept/exceptions/scheduling.py
DependencyError ¶
Bases: JobError
Raised when a job dependency is missing or fails.
Source code in dataexcept/exceptions/external.py
DeserializationError ¶
Bases: JobError
Raised when deserialization of data fails.
Source code in dataexcept/exceptions/parsing.py
EmailError ¶
Bases: NotificationError
Raised when sending an email fails.
Source code in dataexcept/exceptions/notification.py
JobCancellationError ¶
Bases: JobError
Raised when a job is cancelled before completion.
Source code in dataexcept/exceptions/lifecycle.py
JobError ¶
Bases: DataExceptError
Base exception for all job-related errors.
Source code in dataexcept/exceptions/base.py
NotificationError ¶
Bases: JobError
Base exception for notification failures.
Source code in dataexcept/exceptions/notification.py
OperationTimeoutError ¶
Bases: JobError
Raised when an operation exceeds its time limit.
Source code in dataexcept/exceptions/external.py
ParsingError ¶
Bases: JobError
Raised when parsing of input data fails.
Source code in dataexcept/exceptions/parsing.py
ResourceNotFoundError ¶
Bases: JobError
Raised when a required resource cannot be found.
Source code in dataexcept/exceptions/external.py
ScheduleConflictError ¶
Bases: JobError
Raised when two jobs have conflicting schedules.
Source code in dataexcept/exceptions/scheduling.py
SerializationError ¶
Bases: JobError
Raised when serialization of an object fails.
Source code in dataexcept/exceptions/parsing.py
ServiceConnectionError ¶
Bases: JobError
Raised when a connection to an external service fails.
Source code in dataexcept/exceptions/external.py
ValidationError ¶
Bases: JobError
Raised when input data fails validation.
Source code in dataexcept/exceptions/validation.py
WebhookError ¶
Bases: NotificationError
Raised when a webhook POST fails.
Source code in dataexcept/exceptions/notification.py
CustomIOError ¶
FileLockError ¶
Bases: CustomIOError
Raised when a file lock cannot be acquired.
Source code in dataexcept/io_exceptions.py
FileReadError ¶
Bases: CustomIOError
Raised when reading a file fails.
Source code in dataexcept/io_exceptions.py
FileWriteError ¶
Bases: CustomIOError
Raised when writing to a file fails.
Source code in dataexcept/io_exceptions.py
ConnectionTimeoutError ¶
Bases: NetworkError
Raised when a network connection attempt times out.
Example
from dataexcept.network_exceptions import ConnectionTimeoutError try: ... raise ConnectionTimeoutError("api.example.com", 30) ... except ConnectionTimeoutError as exc: ... print(exc) Connection to 'api.example.com' timed out after 30 seconds
Source code in dataexcept/network_exceptions.py
HostUnreachableError ¶
Bases: NetworkError
Raised when a remote host cannot be reached.
Example
from dataexcept.network_exceptions import HostUnreachableError try: ... raise HostUnreachableError("api.example.com") ... except HostUnreachableError as exc: ... print(exc) Host 'api.example.com' is unreachable
Source code in dataexcept/network_exceptions.py
NetworkError ¶
Bases: DataExceptError
Base exception for network-related errors.
Example
from dataexcept.network_exceptions import NetworkError try: ... raise NetworkError("Something went wrong") ... except NetworkError: ... print("Caught network error") Caught network error
Source code in dataexcept/network_exceptions.py
ProtocolError ¶
Bases: NetworkError
Raised when an unexpected protocol error occurs.
Example
from dataexcept.network_exceptions import ProtocolError try: ... raise ProtocolError("HTTP", "Invalid status line") ... except ProtocolError as exc: ... print(exc) Protocol error in HTTP: Invalid status line
Source code in dataexcept/network_exceptions.py
DtypeMismatchError ¶
Bases: PandasError
Raised when a column has an unexpected dtype.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
column
|
str
|
Name of the column. |
required |
expected
|
Sequence[str]
|
Sequence of allowed dtypes. |
required |
found
|
str
|
Detected dtype for the column. |
required |
Source code in dataexcept/pandas_exceptions.py
IndexAlignmentError ¶
Bases: PandasError
Raised when DataFrame indices are misaligned for an operation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
details
|
Optional[str]
|
Optional details about the misalignment. |
None
|
Source code in dataexcept/pandas_exceptions.py
MergeKeyError ¶
Bases: PandasError
Raised when merging DataFrames fails due to key issues.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
left_keys
|
Sequence[str]
|
Keys from the left DataFrame. |
required |
right_keys
|
Sequence[str]
|
Keys from the right DataFrame. |
required |
Source code in dataexcept/pandas_exceptions.py
MissingColumnError ¶
Bases: PandasError
Raised when a required DataFrame column is missing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
column
|
str
|
Name of the missing column. |
required |
dataframe
|
Optional[str]
|
Optional name of the DataFrame being inspected. |
None
|
Source code in dataexcept/pandas_exceptions.py
PandasError ¶
Bases: DataExceptError
Base exception for pandas-related errors.
Source code in dataexcept/pandas_exceptions.py
PandasIOError ¶
Bases: PandasError
Raised when reading from or writing to disk with pandas fails.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
File path involved in the operation. |
required |
original
|
Exception
|
The underlying exception that was raised. |
required |
Source code in dataexcept/pandas_exceptions.py
ApiError ¶
Bases: PipelineError
Failure calling a REST API endpoint.
Source code in dataexcept/pipeline_exceptions.py
DataFetchError ¶
Bases: PipelineError
Failed to fetch data from a storage backend.
Source code in dataexcept/pipeline_exceptions.py
ExternalServiceError ¶
Bases: PipelineError
General failure when calling an external service.
Source code in dataexcept/pipeline_exceptions.py
FeaturePreprocessingError ¶
Bases: PreprocessingError
Raised when feature engineering fails.
Source code in dataexcept/pipeline_exceptions.py
PipelineError ¶
Bases: DataExceptError
Base exception for pipeline errors.
Source code in dataexcept/pipeline_exceptions.py
PipelineNotificationError ¶
Bases: PipelineError
Raised when sending a notification fails.
Source code in dataexcept/pipeline_exceptions.py
PreprocessingError ¶
Bases: PipelineError
Raised when a preprocessing step fails.
Source code in dataexcept/pipeline_exceptions.py
RetryLimitExceededError ¶
Bases: PipelineError
Raised when an operation is retried too many times.
Source code in dataexcept/pipeline_exceptions.py
ServiceAuthenticationError ¶
Bases: ExternalServiceError
Authentication to an external service failed.
Source code in dataexcept/pipeline_exceptions.py
ServiceAuthorizationError ¶
Bases: ExternalServiceError
Authorization was denied by an external service.
Source code in dataexcept/pipeline_exceptions.py
ServiceTimeoutError ¶
Bases: ExternalServiceError
A call to an external service exceeded the allotted time.
Source code in dataexcept/pipeline_exceptions.py
StorageError ¶
Bases: PipelineError
Raised when reading from or writing to storage fails.
Source code in dataexcept/pipeline_exceptions.py
TimeDeltaTooLargeError ¶
Bases: PipelineError
The time span between records exceeded a threshold.
Source code in dataexcept/pipeline_exceptions.py
TypeCheckError ¶
Bases: PipelineError
Invalid type detected during recursive type inspection.
Source code in dataexcept/pipeline_exceptions.py
DecryptionError ¶
Bases: SecurityError
Raised when data decryption fails.
Source code in dataexcept/security_exceptions.py
EncryptionError ¶
Bases: SecurityError
Raised when data encryption fails.
Source code in dataexcept/security_exceptions.py
InvalidTokenError ¶
Bases: SecurityError
Raised when an authentication token is invalid or expired.
Source code in dataexcept/security_exceptions.py
SecurityError ¶
Bases: DataExceptError
Base exception for security errors.
Source code in dataexcept/security_exceptions.py
log_and_raise ¶
log_and_raise(logger: Optional[Logger] = None, level: int = logging.ERROR, context: Context | None = None) -> Iterator[None]
Context manager that logs and re-raises exceptions preserving traceback.
Source code in dataexcept/logging_helpers.py
log_exception ¶
log_exception(exc: Exception, logger: Optional[Logger] = None, level: int = logging.ERROR, context: Context | None = None) -> None
Log exc at the given log level using logger.
If logger is None a module level logger is used.
DataExcept redacts what it renders, but a wrapped third-party exception
renders itself: an HTTP client's error may quote the credential-bearing URL
it was called with, and exc_info makes logging print that whole chain.
When the chain contains a URL the traceback is formatted and scrubbed here;
otherwise the structured exc_info path is used unchanged, so ordinary
exceptions keep the shape log aggregators expect.
Source code in dataexcept/logging_helpers.py
log_then_raise ¶
log_then_raise(exc: Exception, logger: Optional[Logger] = None, level: int = logging.ERROR, context: Context | None = None) -> None
Log exc and immediately raise it.
This helper mirrors the pre-context-manager API for scenarios where adding a
with block would be too intrusive. Prefer :func:log_and_raise whenever
possible so tracebacks remain untouched.
Source code in dataexcept/logging_helpers.py
exception_to_dict ¶
exception_to_dict(exc: BaseException, *, include_attributes: bool = True, max_depth: int = 8) -> dict[str, Any]
Return a strict JSON-safe structured representation of exc.
The representation contains the exception type, module and rendered message, optionally public instance attributes, bounded cause/context chains, and on Python 3.11+ the member tree of exception groups. Traceback frames and private attributes are deliberately excluded.
Source code in dataexcept/serialization.py
exception_to_json ¶
exception_to_json(exc: BaseException, *, include_attributes: bool = True, max_depth: int = 8, **json_kwargs: Any) -> str
Return :func:exception_to_dict encoded as strict JSON.
Source code in dataexcept/serialization.py
wrap ¶
Build target from original, recording it as the cause.
Extra keyword arguments go to the constructor::
raise wrap(exc, DataLoadingError, source=path) from exc
If target accepts a cause parameter, original is passed to it. Either
way __cause__ is set, so a traceback shows the underlying failure even
for a class that records nothing.
An explicit original/cause keyword wins, so a caller can still say
exactly what they mean.
Source code in dataexcept/wrapping.py
Core job exceptions¶
exceptions ¶
AuthenticationError ¶
Bases: JobError
Raised when user authentication fails.
Source code in dataexcept/exceptions/authentication.py
AuthorizationError ¶
Bases: JobError
Raised when user lacks permission for an action.
Source code in dataexcept/exceptions/authentication.py
JobError ¶
Bases: DataExceptError
Base exception for all job-related errors.
Source code in dataexcept/exceptions/base.py
ConfigurationError ¶
Bases: JobError
Raised when there is a problem with configuration or settings.
Source code in dataexcept/exceptions/configuration.py
DependencyError ¶
Bases: JobError
Raised when a job dependency is missing or fails.
Source code in dataexcept/exceptions/external.py
OperationTimeoutError ¶
Bases: JobError
Raised when an operation exceeds its time limit.
Source code in dataexcept/exceptions/external.py
ResourceNotFoundError ¶
Bases: JobError
Raised when a required resource cannot be found.
Source code in dataexcept/exceptions/external.py
ServiceConnectionError ¶
Bases: JobError
Raised when a connection to an external service fails.
Source code in dataexcept/exceptions/external.py
JobCancellationError ¶
Bases: JobError
Raised when a job is cancelled before completion.
Source code in dataexcept/exceptions/lifecycle.py
EmailError ¶
Bases: NotificationError
Raised when sending an email fails.
Source code in dataexcept/exceptions/notification.py
NotificationError ¶
Bases: JobError
Base exception for notification failures.
Source code in dataexcept/exceptions/notification.py
WebhookError ¶
Bases: NotificationError
Raised when a webhook POST fails.
Source code in dataexcept/exceptions/notification.py
DeserializationError ¶
Bases: JobError
Raised when deserialization of data fails.
Source code in dataexcept/exceptions/parsing.py
ParsingError ¶
Bases: JobError
Raised when parsing of input data fails.
Source code in dataexcept/exceptions/parsing.py
SerializationError ¶
Bases: JobError
Raised when serialization of an object fails.
Source code in dataexcept/exceptions/parsing.py
CronExpressionError ¶
Bases: JobError
Raised when a cron expression is invalid.
Source code in dataexcept/exceptions/scheduling.py
ScheduleConflictError ¶
Bases: JobError
Raised when two jobs have conflicting schedules.
Source code in dataexcept/exceptions/scheduling.py
Data science exceptions¶
datascience_exceptions ¶
Custom exceptions for data science workflows.
DataScienceError ¶
Bases: DataExceptError
Base exception for data science errors.
Source code in dataexcept/datascience_exceptions/base.py
DataAugmentationError ¶
Bases: DataScienceError
Raised when a data augmentation technique fails.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
technique
|
str
|
Name of the augmentation technique. |
required |
details
|
Optional[str]
|
Optional explanation of the failure. |
None
|
Source code in dataexcept/datascience_exceptions/ingestion.py
DataFormatError ¶
Bases: DataScienceError
Raised when input data is not in the expected format.
Source code in dataexcept/datascience_exceptions/ingestion.py
DataImbalanceError ¶
Bases: DataScienceError
Raised when class distribution is too imbalanced.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ratio
|
float
|
Observed minority-to-majority ratio. |
required |
threshold
|
float
|
Minimum acceptable ratio. |
required |
message
|
Optional[str]
|
Optional custom error message. |
None
|
Source code in dataexcept/datascience_exceptions/ingestion.py
DataLeakageError ¶
Bases: DataScienceError
Raised when data leakage is detected between train and test sets.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
feature
|
str
|
Name of the leaked feature. |
required |
stage
|
str
|
Stage where the leakage occurred. |
required |
message
|
Optional[str]
|
Optional custom message. |
None
|
Source code in dataexcept/datascience_exceptions/ingestion.py
DataLoadingError ¶
Bases: DataScienceError
Raised when loading data fails.
Attributes:
| Name | Type | Description |
|---|---|---|
source |
data source description (file path, URL). |
|
original |
underlying exception. |
Source code in dataexcept/datascience_exceptions/ingestion.py
DataNormalizationError ¶
Bases: DataScienceError
Raised when data normalization fails.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
method
|
str
|
Normalization technique identifier. |
required |
details
|
Optional[str]
|
Optional explanation of the failure. |
None
|
Source code in dataexcept/datascience_exceptions/ingestion.py
DataValidationError ¶
Bases: DataScienceError
Raised when data fails validation rules.
Attributes:
| Name | Type | Description |
|---|---|---|
field |
name of invalid field. |
|
value |
the invalid value. |
Source code in dataexcept/datascience_exceptions/ingestion.py
FeatureEngineeringError ¶
Bases: DataScienceError
Raised during feature engineering steps.
Attributes:
| Name | Type | Description |
|---|---|---|
step |
description of the step that failed. |
|
cause |
optional underlying reason. |
Source code in dataexcept/datascience_exceptions/ingestion.py
MissingDataError ¶
Bases: DataScienceError
Raised when required data is missing.
Attributes:
| Name | Type | Description |
|---|---|---|
feature |
name of missing feature. |
Source code in dataexcept/datascience_exceptions/ingestion.py
OutlierDetectionError ¶
Bases: DataScienceError
Raised when outlier detection fails.
Attributes:
| Name | Type | Description |
|---|---|---|
method |
detection method name. |
|
details |
optional extra info. |
Source code in dataexcept/datascience_exceptions/ingestion.py
SchemaMismatchError ¶
Bases: DataScienceError
Raised when data schema does not match expected.
Attributes:
| Name | Type | Description |
|---|---|---|
expected |
expected schema description. |
|
found |
actual schema description. |
Source code in dataexcept/datascience_exceptions/ingestion.py
DataDriftError ¶
Bases: DataScienceError
Raised when data drift is detected beyond threshold.
Attributes:
| Name | Type | Description |
|---|---|---|
feature |
feature name. |
|
drift_score |
computed drift metric. |
Source code in dataexcept/datascience_exceptions/operations.py
DataExportError ¶
Bases: DataScienceError
Failed to export or write data to destination.
Source code in dataexcept/datascience_exceptions/operations.py
DeploymentError ¶
Bases: DataScienceError
Raised when deploying a model or pipeline fails.
Attributes:
| Name | Type | Description |
|---|---|---|
target |
deployment target identifier. |
|
cause |
optional detail. |
Source code in dataexcept/datascience_exceptions/operations.py
ModelSerializationError ¶
Bases: DataScienceError
Raised when saving or loading a model fails.
Attributes:
| Name | Type | Description |
|---|---|---|
path |
file path involved. |
|
original |
underlying exception. |
Source code in dataexcept/datascience_exceptions/operations.py
ResourceLimitError ¶
Bases: DataScienceError
Raised when computation exceeds resources (memory, CPU).
Attributes:
| Name | Type | Description |
|---|---|---|
resource |
'memory', 'cpu', etc. |
|
limit |
threshold exceeded. |
Source code in dataexcept/datascience_exceptions/operations.py
BiasDetectionError ¶
Bases: DataScienceError
Raised when algorithmic bias exceeds an acceptable threshold.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
feature
|
str
|
Feature or group where bias was detected. |
required |
bias_score
|
float
|
Calculated bias metric. |
required |
threshold
|
float
|
Maximum acceptable bias metric. |
required |
message
|
Optional[str]
|
Optional custom message. |
None
|
Source code in dataexcept/datascience_exceptions/training.py
ConvergenceError ¶
Bases: ModelTrainingError
Raised when optimization fails to converge.
Attributes:
| Name | Type | Description |
|---|---|---|
iterations |
number of iterations run. |
Source code in dataexcept/datascience_exceptions/training.py
CrossValidationError ¶
Bases: DataScienceError
Failure during cross-validation procedure.
Source code in dataexcept/datascience_exceptions/training.py
DimensionalityReductionError ¶
Bases: DataScienceError
Error applying dimensionality reduction method.
Source code in dataexcept/datascience_exceptions/training.py
EarlyStoppingError ¶
Bases: DataScienceError
Raised when training stops early based on a stopping criterion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
epoch
|
int
|
Epoch index where training stopped. |
required |
reason
|
Optional[str]
|
Optional reason for stopping. |
None
|
Source code in dataexcept/datascience_exceptions/training.py
ExperimentTrackingError ¶
Bases: DataScienceError
Issues logging or retrieving experiment metadata.
Source code in dataexcept/datascience_exceptions/training.py
ExplainabilityError ¶
Bases: DataScienceError
Raised when generating model explanations fails.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
method
|
str
|
Explanation technique identifier. |
required |
details
|
Optional[str]
|
Optional description of the failure. |
None
|
Source code in dataexcept/datascience_exceptions/training.py
FeatureScalingError ¶
Bases: DataScienceError
Raised when scaling or standardization of features fails.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scaler
|
str
|
Name of the scaler or transformation used. |
required |
details
|
Optional[str]
|
Optional explanation of the failure. |
None
|
Source code in dataexcept/datascience_exceptions/training.py
FeatureSelectionError ¶
Bases: DataScienceError
Failure in feature selection procedure.
Source code in dataexcept/datascience_exceptions/training.py
GPUOutOfMemoryError ¶
Bases: DataScienceError
Model or tensor exceeds GPU memory capacity.
Source code in dataexcept/datascience_exceptions/training.py
HyperparameterError ¶
Bases: DataScienceError
Raised for invalid hyperparameter settings.
Attributes:
| Name | Type | Description |
|---|---|---|
param |
name of hyperparameter. |
|
value |
invalid value. |
Source code in dataexcept/datascience_exceptions/training.py
HyperparameterTuningError ¶
Bases: DataScienceError
Error during hyperparameter search or tuning.
Source code in dataexcept/datascience_exceptions/training.py
ModelCompatibilityError ¶
Bases: DataScienceError
Raised when a model is incompatible with the runtime environment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
expected_version
|
str
|
Required model version. |
required |
found_version
|
str
|
Detected model version. |
required |
message
|
Optional[str]
|
Optional custom message. |
None
|
Source code in dataexcept/datascience_exceptions/training.py
ModelEvaluationError ¶
Bases: DataScienceError
Raised during evaluation metrics computation.
Attributes:
| Name | Type | Description |
|---|---|---|
metric |
name of the metric. |
|
value |
computed value. |
Source code in dataexcept/datascience_exceptions/training.py
ModelInferenceError ¶
Bases: DataScienceError
Raised when model inference fails.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_type
|
str
|
Identifier of the model used for inference. |
required |
original
|
Exception
|
Underlying exception raised by the model. |
required |
Source code in dataexcept/datascience_exceptions/training.py
ModelTrainingError ¶
Bases: DataScienceError
Raised when model training fails.
Attributes:
| Name | Type | Description |
|---|---|---|
model_type |
model class or name. |
|
epoch |
optional epoch index. |
Source code in dataexcept/datascience_exceptions/training.py
OverfittingError ¶
Bases: DataScienceError
Raised when a model is overfitting the training data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
train_metric
|
float
|
Metric value on the training set. |
required |
val_metric
|
float
|
Metric value on the validation set. |
required |
Source code in dataexcept/datascience_exceptions/training.py
PredictionError ¶
Bases: DataScienceError
Raised when making predictions fails.
Attributes:
| Name | Type | Description |
|---|---|---|
model_type |
model used. |
|
inputs |
input data snapshot. |
Source code in dataexcept/datascience_exceptions/training.py
TrainingTimeoutError ¶
Bases: ModelTrainingError
Raised when model training exceeds a time limit.
Source code in dataexcept/datascience_exceptions/training.py
UnderfittingError ¶
Bases: DataScienceError
Raised when a model fails to capture patterns in the data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
train_metric
|
float
|
Metric value on the training set. |
required |
threshold
|
float
|
Minimum acceptable metric value. |
required |
Source code in dataexcept/datascience_exceptions/training.py
Data engineering exceptions¶
dataengineering_exceptions ¶
Custom exceptions for data engineering workflows.
DataEngineeringError ¶
Bases: DataExceptError
Base exception for data engineering errors.
Source code in dataexcept/dataengineering_exceptions.py
ETLJobError ¶
Bases: DataEngineeringError
Raised when an ETL job fails to complete successfully.
Source code in dataexcept/dataengineering_exceptions.py
SchemaEvolutionError ¶
Bases: DataEngineeringError
Raised when database schema evolution fails.
Source code in dataexcept/dataengineering_exceptions.py
DataTransformationError ¶
Bases: DataEngineeringError
Raised when a data transformation step fails.
Source code in dataexcept/dataengineering_exceptions.py
BatchProcessingError ¶
Bases: DataEngineeringError
Raised when processing a data batch fails.
Source code in dataexcept/dataengineering_exceptions.py
DataWarehouseConnectionError ¶
Bases: DataEngineeringError
Raised when a connection to a data warehouse cannot be established.
Source code in dataexcept/dataengineering_exceptions.py
MissingPartitionError ¶
Bases: DataEngineeringError
Raised when a required data partition is missing.
Source code in dataexcept/dataengineering_exceptions.py
Pipeline exceptions¶
pipeline_exceptions ¶
Additional exception classes for data pipeline workflows.
PipelineError ¶
Bases: DataExceptError
Base exception for pipeline errors.
Source code in dataexcept/pipeline_exceptions.py
PreprocessingError ¶
Bases: PipelineError
Raised when a preprocessing step fails.
Source code in dataexcept/pipeline_exceptions.py
FeaturePreprocessingError ¶
Bases: PreprocessingError
Raised when feature engineering fails.
Source code in dataexcept/pipeline_exceptions.py
StorageError ¶
Bases: PipelineError
Raised when reading from or writing to storage fails.
Source code in dataexcept/pipeline_exceptions.py
PipelineNotificationError ¶
Bases: PipelineError
Raised when sending a notification fails.
Source code in dataexcept/pipeline_exceptions.py
RetryLimitExceededError ¶
Bases: PipelineError
Raised when an operation is retried too many times.
Source code in dataexcept/pipeline_exceptions.py
ExternalServiceError ¶
Bases: PipelineError
General failure when calling an external service.
Source code in dataexcept/pipeline_exceptions.py
ServiceAuthenticationError ¶
Bases: ExternalServiceError
Authentication to an external service failed.
Source code in dataexcept/pipeline_exceptions.py
ServiceAuthorizationError ¶
Bases: ExternalServiceError
Authorization was denied by an external service.
Source code in dataexcept/pipeline_exceptions.py
ServiceTimeoutError ¶
Bases: ExternalServiceError
A call to an external service exceeded the allotted time.
Source code in dataexcept/pipeline_exceptions.py
ApiError ¶
Bases: PipelineError
Failure calling a REST API endpoint.
Source code in dataexcept/pipeline_exceptions.py
TimeDeltaTooLargeError ¶
Bases: PipelineError
The time span between records exceeded a threshold.
Source code in dataexcept/pipeline_exceptions.py
TypeCheckError ¶
Bases: PipelineError
Invalid type detected during recursive type inspection.
Source code in dataexcept/pipeline_exceptions.py
DataFetchError ¶
Bases: PipelineError
Failed to fetch data from a storage backend.
Source code in dataexcept/pipeline_exceptions.py
Database exceptions¶
database_exceptions ¶
Custom exceptions for database operations.
DatabaseError ¶
Bases: DataExceptError
Base exception for database-related errors.
Source code in dataexcept/database_exceptions.py
DatabaseConnectionError ¶
Bases: DatabaseError
Raised when connecting to the database fails.
Source code in dataexcept/database_exceptions.py
QueryExecutionError ¶
Bases: DatabaseError
Raised when a database query execution fails.
Source code in dataexcept/database_exceptions.py
TransactionError ¶
Bases: DatabaseError
Raised when a database transaction fails.
Source code in dataexcept/database_exceptions.py
I/O exceptions¶
io_exceptions ¶
Custom exceptions for file and I/O operations.
CustomIOError ¶
FileReadError ¶
Bases: CustomIOError
Raised when reading a file fails.
Source code in dataexcept/io_exceptions.py
FileWriteError ¶
Bases: CustomIOError
Raised when writing to a file fails.
Source code in dataexcept/io_exceptions.py
FileLockError ¶
Bases: CustomIOError
Raised when a file lock cannot be acquired.
Source code in dataexcept/io_exceptions.py
Network exceptions¶
network_exceptions ¶
Custom exceptions for network operations.
NetworkError ¶
Bases: DataExceptError
Base exception for network-related errors.
Example
from dataexcept.network_exceptions import NetworkError try: ... raise NetworkError("Something went wrong") ... except NetworkError: ... print("Caught network error") Caught network error
Source code in dataexcept/network_exceptions.py
HostUnreachableError ¶
Bases: NetworkError
Raised when a remote host cannot be reached.
Example
from dataexcept.network_exceptions import HostUnreachableError try: ... raise HostUnreachableError("api.example.com") ... except HostUnreachableError as exc: ... print(exc) Host 'api.example.com' is unreachable
Source code in dataexcept/network_exceptions.py
ConnectionTimeoutError ¶
Bases: NetworkError
Raised when a network connection attempt times out.
Example
from dataexcept.network_exceptions import ConnectionTimeoutError try: ... raise ConnectionTimeoutError("api.example.com", 30) ... except ConnectionTimeoutError as exc: ... print(exc) Connection to 'api.example.com' timed out after 30 seconds
Source code in dataexcept/network_exceptions.py
ProtocolError ¶
Bases: NetworkError
Raised when an unexpected protocol error occurs.
Example
from dataexcept.network_exceptions import ProtocolError try: ... raise ProtocolError("HTTP", "Invalid status line") ... except ProtocolError as exc: ... print(exc) Protocol error in HTTP: Invalid status line
Source code in dataexcept/network_exceptions.py
pandas exceptions¶
pandas_exceptions ¶
Custom exceptions for pandas DataFrame operations.
PandasError ¶
Bases: DataExceptError
Base exception for pandas-related errors.
Source code in dataexcept/pandas_exceptions.py
MissingColumnError ¶
Bases: PandasError
Raised when a required DataFrame column is missing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
column
|
str
|
Name of the missing column. |
required |
dataframe
|
Optional[str]
|
Optional name of the DataFrame being inspected. |
None
|
Source code in dataexcept/pandas_exceptions.py
DtypeMismatchError ¶
Bases: PandasError
Raised when a column has an unexpected dtype.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
column
|
str
|
Name of the column. |
required |
expected
|
Sequence[str]
|
Sequence of allowed dtypes. |
required |
found
|
str
|
Detected dtype for the column. |
required |
Source code in dataexcept/pandas_exceptions.py
IndexAlignmentError ¶
Bases: PandasError
Raised when DataFrame indices are misaligned for an operation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
details
|
Optional[str]
|
Optional details about the misalignment. |
None
|
Source code in dataexcept/pandas_exceptions.py
MergeKeyError ¶
Bases: PandasError
Raised when merging DataFrames fails due to key issues.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
left_keys
|
Sequence[str]
|
Keys from the left DataFrame. |
required |
right_keys
|
Sequence[str]
|
Keys from the right DataFrame. |
required |
Source code in dataexcept/pandas_exceptions.py
PandasIOError ¶
Bases: PandasError
Raised when reading from or writing to disk with pandas fails.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
File path involved in the operation. |
required |
original
|
Exception
|
The underlying exception that was raised. |
required |
Source code in dataexcept/pandas_exceptions.py
Security exceptions¶
security_exceptions ¶
Custom exceptions for security-related operations.
SecurityError ¶
Bases: DataExceptError
Base exception for security errors.
Source code in dataexcept/security_exceptions.py
EncryptionError ¶
Bases: SecurityError
Raised when data encryption fails.
Source code in dataexcept/security_exceptions.py
DecryptionError ¶
Bases: SecurityError
Raised when data decryption fails.
Source code in dataexcept/security_exceptions.py
InvalidTokenError ¶
Bases: SecurityError
Raised when an authentication token is invalid or expired.
Source code in dataexcept/security_exceptions.py
Logging helpers¶
logging_helpers ¶
Helper functions for logging exceptions consistently.
log_exception ¶
log_exception(exc: Exception, logger: Optional[Logger] = None, level: int = logging.ERROR, context: Context | None = None) -> None
Log exc at the given log level using logger.
If logger is None a module level logger is used.
DataExcept redacts what it renders, but a wrapped third-party exception
renders itself: an HTTP client's error may quote the credential-bearing URL
it was called with, and exc_info makes logging print that whole chain.
When the chain contains a URL the traceback is formatted and scrubbed here;
otherwise the structured exc_info path is used unchanged, so ordinary
exceptions keep the shape log aggregators expect.
Source code in dataexcept/logging_helpers.py
log_and_raise ¶
log_and_raise(logger: Optional[Logger] = None, level: int = logging.ERROR, context: Context | None = None) -> Iterator[None]
Context manager that logs and re-raises exceptions preserving traceback.
Source code in dataexcept/logging_helpers.py
log_then_raise ¶
log_then_raise(exc: Exception, logger: Optional[Logger] = None, level: int = logging.ERROR, context: Context | None = None) -> None
Log exc and immediately raise it.
This helper mirrors the pre-context-manager API for scenarios where adding a
with block would be too intrusive. Prefer :func:log_and_raise whenever
possible so tracebacks remain untouched.
Source code in dataexcept/logging_helpers.py
Command-line entry point¶
__main__ ¶
Command line interface for the DataExcept package.
main ¶
Entry point for the dataexcept command.