From 4a52a71956a8d46fcb7294ac71734504bb09bcc2 Mon Sep 17 00:00:00 2001 From: S. Solomon Darnell Date: Fri, 28 Mar 2025 21:52:21 -0500 Subject: two version of R2R are here --- .../lib/python3.12/site-packages/h2/exceptions.py | 194 +++++++++++++++++++++ 1 file changed, 194 insertions(+) create mode 100644 .venv/lib/python3.12/site-packages/h2/exceptions.py (limited to '.venv/lib/python3.12/site-packages/h2/exceptions.py') diff --git a/.venv/lib/python3.12/site-packages/h2/exceptions.py b/.venv/lib/python3.12/site-packages/h2/exceptions.py new file mode 100644 index 00000000..e4776795 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/h2/exceptions.py @@ -0,0 +1,194 @@ +""" +h2/exceptions +~~~~~~~~~~~~~ + +Exceptions for the HTTP/2 module. +""" +from __future__ import annotations + +from .errors import ErrorCodes + + +class H2Error(Exception): + """ + The base class for all exceptions for the HTTP/2 module. + """ + + +class ProtocolError(H2Error): + """ + An action was attempted in violation of the HTTP/2 protocol. + """ + + #: The error code corresponds to this kind of Protocol Error. + error_code = ErrorCodes.PROTOCOL_ERROR + + +class FrameTooLargeError(ProtocolError): + """ + The frame that we tried to send or that we received was too large. + """ + + #: The error code corresponds to this kind of Protocol Error. + error_code = ErrorCodes.FRAME_SIZE_ERROR + + +class FrameDataMissingError(ProtocolError): + """ + The frame that we received is missing some data. + + .. versionadded:: 2.0.0 + """ + + #: The error code corresponds to this kind of Protocol Error. + error_code = ErrorCodes.FRAME_SIZE_ERROR + + +class TooManyStreamsError(ProtocolError): + """ + An attempt was made to open a stream that would lead to too many concurrent + streams. + """ + + + +class FlowControlError(ProtocolError): + """ + An attempted action violates flow control constraints. + """ + + #: The error code corresponds to this kind of Protocol Error. + error_code = ErrorCodes.FLOW_CONTROL_ERROR + + +class StreamIDTooLowError(ProtocolError): + """ + An attempt was made to open a stream that had an ID that is lower than the + highest ID we have seen on this connection. + """ + + def __init__(self, stream_id: int, max_stream_id: int) -> None: + #: The ID of the stream that we attempted to open. + self.stream_id = stream_id + + #: The current highest-seen stream ID. + self.max_stream_id = max_stream_id + + def __str__(self) -> str: + return f"StreamIDTooLowError: {self.stream_id} is lower than {self.max_stream_id}" + + +class NoAvailableStreamIDError(ProtocolError): + """ + There are no available stream IDs left to the connection. All stream IDs + have been exhausted. + + .. versionadded:: 2.0.0 + """ + + + +class NoSuchStreamError(ProtocolError): + """ + A stream-specific action referenced a stream that does not exist. + + .. versionchanged:: 2.0.0 + Became a subclass of :class:`ProtocolError +