107 lines
4.6 KiB
Python
107 lines
4.6 KiB
Python
# uncompyle6 version 3.9.2
|
|
# Python bytecode version base 3.7.0 (3394)
|
|
# Decompiled from: Python 3.8.19 (default, Mar 20 2024, 15:27:52)
|
|
# [Clang 14.0.6 ]
|
|
# Embedded file name: /var/user/app/device_supervisorbak/device_supervisor/lib/h2/exceptions.py
|
|
# Compiled at: 2024-04-18 03:12:55
|
|
# Size of source mod 2**32: 5379 bytes
|
|
"""
|
|
h2/exceptions
|
|
~~~~~~~~~~~~~
|
|
|
|
Exceptions for the HTTP/2 module.
|
|
"""
|
|
import h2.errors
|
|
|
|
class H2Error(Exception):
|
|
__doc__ = "\n The base class for all exceptions for the HTTP/2 module.\n "
|
|
|
|
|
|
class ProtocolError(H2Error):
|
|
__doc__ = "\n An action was attempted in violation of the HTTP/2 protocol.\n "
|
|
error_code = h2.errors.ErrorCodes.PROTOCOL_ERROR
|
|
|
|
|
|
class FrameTooLargeError(ProtocolError):
|
|
__doc__ = "\n The frame that we tried to send or that we received was too large.\n "
|
|
error_code = h2.errors.ErrorCodes.FRAME_SIZE_ERROR
|
|
|
|
|
|
class FrameDataMissingError(ProtocolError):
|
|
__doc__ = "\n The frame that we received is missing some data.\n\n .. versionadded:: 2.0.0\n "
|
|
error_code = h2.errors.ErrorCodes.FRAME_SIZE_ERROR
|
|
|
|
|
|
class TooManyStreamsError(ProtocolError):
|
|
__doc__ = "\n An attempt was made to open a stream that would lead to too many concurrent\n streams.\n "
|
|
|
|
|
|
class FlowControlError(ProtocolError):
|
|
__doc__ = "\n An attempted action violates flow control constraints.\n "
|
|
error_code = h2.errors.ErrorCodes.FLOW_CONTROL_ERROR
|
|
|
|
|
|
class StreamIDTooLowError(ProtocolError):
|
|
__doc__ = "\n An attempt was made to open a stream that had an ID that is lower than the\n highest ID we have seen on this connection.\n "
|
|
|
|
def __init__(self, stream_id, max_stream_id):
|
|
self.stream_id = stream_id
|
|
self.max_stream_id = max_stream_id
|
|
|
|
def __str__(self):
|
|
return "StreamIDTooLowError: %d is lower than %d" % (
|
|
self.stream_id, self.max_stream_id)
|
|
|
|
|
|
class NoAvailableStreamIDError(ProtocolError):
|
|
__doc__ = "\n There are no available stream IDs left to the connection. All stream IDs\n have been exhausted.\n\n .. versionadded:: 2.0.0\n "
|
|
|
|
|
|
class NoSuchStreamError(ProtocolError):
|
|
__doc__ = "\n A stream-specific action referenced a stream that does not exist.\n\n .. versionchanged:: 2.0.0\n Became a subclass of :class:`ProtocolError\n <h2.exceptions.ProtocolError>`\n "
|
|
|
|
def __init__(self, stream_id):
|
|
self.stream_id = stream_id
|
|
|
|
|
|
class StreamClosedError(NoSuchStreamError):
|
|
__doc__ = "\n A more specific form of\n :class:`NoSuchStreamError <h2.exceptions.NoSuchStreamError>`. Indicates\n that the stream has since been closed, and that all state relating to that\n stream has been removed.\n "
|
|
|
|
def __init__(self, stream_id):
|
|
self.stream_id = stream_id
|
|
self.error_code = h2.errors.ErrorCodes.STREAM_CLOSED
|
|
self._events = []
|
|
|
|
|
|
class InvalidSettingsValueError(ProtocolError, ValueError):
|
|
__doc__ = "\n An attempt was made to set an invalid Settings value.\n\n .. versionadded:: 2.0.0\n "
|
|
|
|
def __init__(self, msg, error_code):
|
|
super(InvalidSettingsValueError, self).__init__(msg)
|
|
self.error_code = error_code
|
|
|
|
|
|
class InvalidBodyLengthError(ProtocolError):
|
|
__doc__ = "\n The remote peer sent more or less data that the Content-Length header\n indicated.\n\n .. versionadded:: 2.0.0\n "
|
|
|
|
def __init__(self, expected, actual):
|
|
self.expected_length = expected
|
|
self.actual_length = actual
|
|
|
|
def __str__(self):
|
|
return "InvalidBodyLengthError: Expected %d bytes, received %d" % (
|
|
self.expected_length, self.actual_length)
|
|
|
|
|
|
class UnsupportedFrameError(ProtocolError, KeyError):
|
|
__doc__ = "\n The remote peer sent a frame that is unsupported in this context.\n\n .. versionadded:: 2.1.0\n "
|
|
|
|
|
|
class RFC1122Error(H2Error):
|
|
__doc__ = "\n Emitted when users attempt to do something that is literally allowed by the\n relevant RFC, but is sufficiently ill-defined that it's unwise to allow\n users to actually do it.\n\n While there is some disagreement about whether or not we should be liberal\n in what accept, it is a truth universally acknowledged that we should be\n conservative in what emit.\n\n .. versionadded:: 2.4.0\n "
|
|
|
|
|
|
class DenialOfServiceError(ProtocolError):
|
|
__doc__ = "\n Emitted when the remote peer exhibits a behaviour that is likely to be an\n attempt to perform a Denial of Service attack on the implementation. This\n is a form of ProtocolError that carries a different error code, and allows\n more easy detection of this kind of behaviour.\n\n .. versionadded:: 2.5.0\n "
|
|
error_code = h2.errors.ErrorCodes.ENHANCE_YOUR_CALM
|