Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
exceptions.py62 linesDownload Raw Back to hyperframe
1"""2Exceptions that can be thrown by hyperframe.3"""4from __future__ import annotations5 6 7class HyperframeError(Exception):8    """9    The base class for all exceptions for the hyperframe module.10 11    .. versionadded:: 6.0.012    """13 14 15class UnknownFrameError(HyperframeError):16    """17    A frame of unknown type was received.18 19    .. versionchanged:: 6.0.020        Changed base class from `ValueError` to :class:`HyperframeError`21    """22 23    def __init__(self, frame_type: int, length: int) -> None:24        #: The type byte of the unknown frame that was received.25        self.frame_type = frame_type26 27        #: The length of the data portion of the unknown frame.28        self.length = length29 30    def __str__(self) -> str:31        return (32            f"UnknownFrameError: Unknown frame type 0x{self.frame_type:X} received, length {self.length} bytes"33        )34 35 36class InvalidPaddingError(HyperframeError):37    """38    A frame with invalid padding was received.39 40    .. versionchanged:: 6.0.041        Changed base class from `ValueError` to :class:`HyperframeError`42    """43 44 45class InvalidFrameError(HyperframeError):46    """47    Parsing a frame failed because the data was not laid out appropriately.48 49    .. versionadded:: 3.0.250 51    .. versionchanged:: 6.0.052        Changed base class from `ValueError` to :class:`HyperframeError`53    """54 55 56class InvalidDataError(HyperframeError):57    """58    Content or data of a frame was is invalid or violates the specification.59 60    .. versionadded:: 6.0.061    """62 
codekingpro/portable-devtools · Team Ai