biosigIO 1.1.7
Typed read-error hierarchy (biosigio.exceptions)
biosigIO previously raised a generic ValueError for every read failure, so a
caller could not tell why a recording failed to load — a trial-averaged
derivative, a truncated file, and an unsupported format were indistinguishable.
This release adds a typed hierarchy so callers can classify the failure and
surface a specific reason (the NEMAR Zarr viewer uses this to explain why a
recording has no viewer instead of a blank "not available"):
BiosigIOError— base; every error carries a stable.code.UnsupportedFormatError(unsupported_format)FileReadError(file_read_error) — generic fallback for a recognized format
that still couldn't be read.NotContinuousRecordingError(not_continuous) — evoked*-ave.fif/ epoched
*-epo.fifderivatives: valid data, but no continuous time series.CorruptFileError(corrupt_or_truncated) — truncated/non-compliant files,
incomplete CTF.meg4, or an incomplete split chain.EmptyRecordingError(empty_recording)MixedSamplingRateError(mixed_sampling_rate)classify_read_error(exc, filepath)maps a low-level MNE/pyedflib failure to
the right type (shared by the importers).REASONS:code→ default user-facing copy.
The MEG, EDF, BrainVision, and EEGLAB importers now raise these typed errors;
_infer_importer raises UnsupportedFormatError for unknown extensions.
Backward compatibility
BiosigIOError subclasses ValueError, so existing except ValueError /
pytest.raises(ValueError) callers keep working unchanged. The EDF mixed-rate
policy error is now MixedSamplingRateError (still a ValueError, same message).
Tests
Real-file verification (no mocks) for each NEMAR failure mode: a real MNE evoked
-ave.fif → not_continuous, an incomplete split-FIF chain → corrupt, a truncated
CTF .meg4 → corrupt, a truncated EDF → corrupt, plus classifier units and
back-compat assertions.