Skip to content

Exceptions API

src.core.exceptions

This module provides all exceptions used within the system. All exceptions inherit from the base class CGMProcessorError or one of the subsequent children classes.

CGMProcessorError

Bases: Exception

Base exception for all CGM processor errors.

Source code in src/core/exceptions.py
class CGMProcessorError(Exception):
    """Base exception for all CGM processor errors."""

    def __init__(self, message: str, details: Optional[Dict[str, Any]] = None):
        super().__init__(message)
        self.details = details or {}

details = details or {} instance-attribute

__init__(message: str, details: Optional[Dict[str, Any]] = None)

Source code in src/core/exceptions.py
def __init__(self, message: str, details: Optional[Dict[str, Any]] = None):
    super().__init__(message)
    self.details = details or {}

FileError

Bases: CGMProcessorError

Base class for file-related errors.

Source code in src/core/exceptions.py
class FileError(CGMProcessorError):
    """Base class for file-related errors."""

FileAccessError

Bases: FileError

Raised when there's an error accessing a file.

Source code in src/core/exceptions.py
class FileAccessError(FileError):
    """Raised when there's an error accessing a file."""

FileExtensionError

Bases: FileError

Raised When file extension is not supported.

Source code in src/core/exceptions.py
class FileExtensionError(FileError):
    """Raised When file extension is not supported."""

FileParseError

Bases: FileError

Raised when there's an error parsing file contents.

Source code in src/core/exceptions.py
class FileParseError(FileError):
    """Raised when there's an error parsing file contents."""

FormatError

Bases: CGMProcessorError

Base class for format-related errors.

Source code in src/core/exceptions.py
class FormatError(CGMProcessorError):
    """Base class for format-related errors."""

FormatDetectionError

Bases: FormatError

Raised when there's an error detecting file format.

Source code in src/core/exceptions.py
class FormatDetectionError(FormatError):
    """Raised when there's an error detecting file format."""

FormatLoadingError

Bases: FormatError

Raised when a format file can`t be loaded.

Source code in src/core/exceptions.py
class FormatLoadingError(FormatError):
    """Raised when a format file can`t be loaded."""

FormatValidationError

Bases: FormatError

Raised when there's an error validating format definition.

Source code in src/core/exceptions.py
class FormatValidationError(FormatError):
    """Raised when there's an error validating format definition."""

DeviceFormatError

Bases: FormatError

Raised for device-specific format issues.

Source code in src/core/exceptions.py
class DeviceFormatError(FormatError):
    """Raised for device-specific format issues."""

ReaderError

Bases: CGMProcessorError

Base class for reader related errors.

Source code in src/core/exceptions.py
class ReaderError(CGMProcessorError):
    """Base class for reader related errors."""

ProcessingError

Bases: CGMProcessorError

Base class for data processing errors.

Source code in src/core/exceptions.py
class ProcessingError(CGMProcessorError):
    """Base class for data processing errors."""

DataProcessingError

Bases: ProcessingError

Raised when there's an error processing data.

Source code in src/core/exceptions.py
class DataProcessingError(ProcessingError):
    """Raised when there's an error processing data."""

TimestampProcessingError

Bases: ProcessingError

Raised when there is a timestamp format issues

Source code in src/core/exceptions.py
class TimestampProcessingError(ProcessingError):
    """Raised when there is a timestamp format issues"""

AlignmentError

Bases: ProcessingError

Raised when there is an error aligning datasets

Source code in src/core/exceptions.py
class AlignmentError(ProcessingError):
    """Raised when there is an error aligning datasets"""

DataExistsError

Bases: FileError

Raised when the reader returns no data

Source code in src/core/exceptions.py
class DataExistsError(FileError):
    """Raised when the reader returns no data"""

ValidationError

Bases: CGMProcessorError

Base class for validation errors.

Source code in src/core/exceptions.py
class ValidationError(CGMProcessorError):
    """Base class for validation errors."""

DataValidationError

Bases: ValidationError

Raised when there's an error validating data.

Source code in src/core/exceptions.py
class DataValidationError(ValidationError):
    """Raised when there's an error validating data."""

ExportError

Bases: CGMProcessorError

Base class for export errors

Source code in src/core/exceptions.py
class ExportError(CGMProcessorError):
    """Base class for export errors"""

DataQualityError

Bases: ProcessingError

Raised when data quality checks fail (e.g., too many gaps, noise).

Source code in src/core/exceptions.py
class DataQualityError(ProcessingError):
    """Raised when data quality checks fail (e.g., too many gaps, noise)."""

TimeAlignmentError

Bases: ProcessingError

Raised when there are issues aligning different data streams (e.g., CGM with insulin).

Source code in src/core/exceptions.py
class TimeAlignmentError(ProcessingError):
    """Raised when there are issues aligning different data streams (e.g., CGM with insulin)."""

UnitConversionError

Bases: ProcessingError

Raised for unit conversion issues (e.g., mg/dL to mmol/L).

Source code in src/core/exceptions.py
class UnitConversionError(ProcessingError):
    """Raised for unit conversion issues (e.g., mg/dL to mmol/L)."""

MetricCalculationError

Bases: ProcessingError

Raised when there are issues calculating diabetes metrics.

Source code in src/core/exceptions.py
class MetricCalculationError(ProcessingError):
    """Raised when there are issues calculating diabetes metrics."""

CalibrationError

Bases: ProcessingError

Raised for sensor calibration related issues.

Source code in src/core/exceptions.py
class CalibrationError(ProcessingError):
    """Raised for sensor calibration related issues."""

DataGapError

Bases: DataQualityError

Raised when data gaps exceed acceptable thresholds.

Source code in src/core/exceptions.py
class DataGapError(DataQualityError):
    """Raised when data gaps exceed acceptable thresholds."""