Source code for intan.io._exceptions

"""
intan.io._exceptions

Custom exception classes used throughout the `intan` package.

These exceptions provide clearer debugging information for:
- Invalid or corrupted `.rhd` files
- Mismatched channel definitions
- Broken TCP streams from the RHX server
- File size or format inconsistencies

Each exception inherits from `Exception` and includes a brief description.
"""

[docs] class UnrecognizedFileError(Exception): """Exception returned when reading a file as an RHD header yields an invalid magic number (indicating this is not an RHD header file). """
[docs] class UnknownChannelTypeError(Exception): """Exception returned when a channel field in RHD header does not have a recognized signal_type value. Accepted values are: 0: amplifier channel 1: aux input channel 2: supply voltage channel 3: board adc channel 4: dig in channel 5: dig out channel """
[docs] class FileSizeError(Exception): """Exception returned when file reading fails due to the file size being invalid or the calculated file size differing from the actual file size. """
[docs] class QStringError(Exception): """Exception returned when reading a QString fails because it is too long. """
[docs] class ChannelNotFoundError(Exception): """Exception returned when plotting fails due to the specified channel not being found. """
[docs] class GetSampleRateFailure(Exception): """Exception returned when the TCP socket failed to yield the sample rate as reported by the RHX software. """
[docs] class InvalidReceivedDataSize(Exception): """Exception returned when the amount of data received on the TCP socket is not an integer multiple of the excepted data block size. """
[docs] class InvalidMagicNumber(Exception): """Exception returned when the first 4 bytes of a data block are not the expected RHX TCP magic number (0x2ef07a08). """