Exceptions

All exceptions inherit from ECGDataKitError.

Import: from ecgdatakit import ECGDataKitError, UnsupportedFormatError, ...

ECGDataKitError

Base exception for all ECGDataKit errors.

UnsupportedFormatError

File format not recognized by any parser.

CorruptedFileError

File is truncated or structurally invalid.

MissingElementError

Required element or field is missing from the file.

ChecksumError

Checksum or CRC validation failed.

RawSamplesError

Operation requires physical-unit samples but the lead still contains raw ADC values. Call to_physical() first.

Example

from ecgdatakit import FileParser, UnsupportedFormatError

try:
    record = FileParser().parse("unknown.bin")
except UnsupportedFormatError as e:
    print(f"Format not supported: {e}")
from ecgdatakit.exceptions import RawSamplesError

try:
    lead.convert_units("mV")
except RawSamplesError:
    lead = lead.to_physical().convert_units("mV")

Full API

exception ecgdatakit.exceptions.ECGDataKitError[source]

Bases: Exception

Base exception for all ecgdatakit errors.

exception ecgdatakit.exceptions.UnsupportedFormatError[source]

Bases: ECGDataKitError

File format is not recognized or not supported.

exception ecgdatakit.exceptions.CorruptedFileError[source]

Bases: ECGDataKitError

File appears corrupted or truncated.

exception ecgdatakit.exceptions.MissingElementError[source]

Bases: ECGDataKitError

Expected XML element or binary field is missing.

exception ecgdatakit.exceptions.ChecksumError[source]

Bases: ECGDataKitError

File checksum validation failed.

exception ecgdatakit.exceptions.RawSamplesError[source]

Bases: ECGDataKitError

Operation requires physical-unit samples but samples are still raw ADC.

Call Lead.to_physical() or ECGRecord.to_physical() first.