Exceptions¶
All exceptions inherit from ECGDataKitError.
Import: from ecgdatakit import ECGDataKitError, UnsupportedFormatError, ...
ECGDataKitErrorBase exception for all ECGDataKit errors.
UnsupportedFormatErrorFile format not recognized by any parser.
CorruptedFileErrorFile is truncated or structurally invalid.
MissingElementErrorRequired element or field is missing from the file.
ChecksumErrorChecksum or CRC validation failed.
RawSamplesErrorOperation 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:
ExceptionBase exception for all ecgdatakit errors.
- exception ecgdatakit.exceptions.UnsupportedFormatError[source]¶
Bases:
ECGDataKitErrorFile format is not recognized or not supported.
- exception ecgdatakit.exceptions.CorruptedFileError[source]¶
Bases:
ECGDataKitErrorFile appears corrupted or truncated.
- exception ecgdatakit.exceptions.MissingElementError[source]¶
Bases:
ECGDataKitErrorExpected XML element or binary field is missing.
- exception ecgdatakit.exceptions.ChecksumError[source]¶
Bases:
ECGDataKitErrorFile checksum validation failed.
- exception ecgdatakit.exceptions.RawSamplesError[source]¶
Bases:
ECGDataKitErrorOperation requires physical-unit samples but samples are still raw ADC.
Call
Lead.to_physical()orECGRecord.to_physical()first.