Source code for bhf_smarthealth.exceptions

"""This module contains custom Exception classes for error-handling within the Smart Health pipeline"""


[docs] class SmartHealthBaseException(Exception): """Base exception class for the Smart Health library""" def __init__(self, message: str): super().__init__(message)
# ! ---- Smart Health Base Exceptions ---- !
[docs] class ISODateConversionError(SmartHealthBaseException): """Custom exception raised if a date cannot be converted to ISO 8601 format""" pass
[docs] class RawDataProcessingError(SmartHealthBaseException): """Base exception class for errors processing raw data""" pass
[docs] class DataVolumeError(SmartHealthBaseException): """Custom exception to raise for errors with data volume""" pass
# ! ---- RawDataProcessing child errors ---- !
[docs] class JSONStructureError(RawDataProcessingError): """Custom exception to be raised for if raw JSON does not have the expected keys""" pass
[docs] class MetadataValidationError(RawDataProcessingError): """Custom exception to be raised for errors whilst validating raw JSON file metadata""" pass
[docs] class DataValidationError(RawDataProcessingError): """Custom exception to use as a wrapper around pydantic's ValidationError""" pass
# ! ---- DataVolume child errors ---- !
[docs] class EmptyFileError(DataVolumeError): """Custom exception to raise if a file contains no usable data""" pass
[docs] class InsufficientValidDataError(DataVolumeError): """Custom exception to raise if a file contains no usable data""" pass