
    'Xh                    l   d Z ddlmZ ddlmZ  G d de      Z G d de      Z G d	 d
e      Z G d de      Z	 G d de      Z
 G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d dee      Z G d de      Z G d de      Z G d d e      Z G d! d"e      Zy#)$z@
h2/exceptions
~~~~~~~~~~~~~

Exceptions for the HTTP/2 module.
    )annotations   )
ErrorCodesc                      e Zd ZdZy)H2ErrorzB
    The base class for all exceptions for the HTTP/2 module.
    N__name__
__module____qualname____doc__     7/RAG/venv/lib/python3.12/site-packages/h2/exceptions.pyr   r      s    r   r   c                  (    e Zd ZdZej
                  Zy)ProtocolErrorzF
    An action was attempted in violation of the HTTP/2 protocol.
    N)r	   r
   r   r   r   PROTOCOL_ERROR
error_coder   r   r   r   r      s    
 **Jr   r   c                  (    e Zd ZdZej
                  Zy)FrameTooLargeErrorzL
    The frame that we tried to send or that we received was too large.
    Nr	   r
   r   r   r   FRAME_SIZE_ERRORr   r   r   r   r   r      s    
 ,,Jr   r   c                  (    e Zd ZdZej
                  Zy)FrameDataMissingErrorzW
    The frame that we received is missing some data.

    .. versionadded:: 2.0.0
    Nr   r   r   r   r   r   $   s     ,,Jr   r   c                      e Zd ZdZy)TooManyStreamsErrorzb
    An attempt was made to open a stream that would lead to too many concurrent
    streams.
    Nr   r   r   r   r   r   /   s    r   r   c                  (    e Zd ZdZej
                  Zy)FlowControlErrorz@
    An attempted action violates flow control constraints.
    N)r	   r
   r   r   r   FLOW_CONTROL_ERRORr   r   r   r   r   r   7   s    
 ..Jr   r   c                       e Zd ZdZddZddZy)StreamIDTooLowErrorz
    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.
    c                     || _         || _        y N	stream_idmax_stream_id)selfr$   r%   s      r   __init__zStreamIDTooLowError.__init__F   s    " +r   c                :    d| j                    d| j                   S )NzStreamIDTooLowError: z is lower than r#   r&   s    r   __str__zStreamIDTooLowError.__str__M   s!    &t~~&6odFXFXEYZZr   N)r$   intr%   r+   returnNoner,   strr	   r
   r   r   r'   r*   r   r   r   r    r    @   s    
+[r   r    c                      e Zd ZdZy)NoAvailableStreamIDErrorz
    There are no available stream IDs left to the connection. All stream IDs
    have been exhausted.

    .. versionadded:: 2.0.0
    Nr   r   r   r   r2   r2   Q   s    r   r2   c                      e Zd ZdZddZy)NoSuchStreamErrorz
    A stream-specific action referenced a stream that does not exist.

    .. versionchanged:: 2.0.0
       Became a subclass of :class:`ProtocolError
       <h2.exceptions.ProtocolError>`
    c                    || _         y r"   )r$   r&   r$   s     r   r'   zNoSuchStreamError.__init__d   s	    "r   Nr$   r+   r,   r-   r	   r
   r   r   r'   r   r   r   r4   r4   [   s    #r   r4   c                      e Zd ZdZddZy)StreamClosedErrorz
    A more specific form of
    :class:`NoSuchStreamError <h2.exceptions.NoSuchStreamError>`. Indicates
    that the stream has since been closed, and that all state relating to that
    stream has been removed.
    c                J    || _         t        j                  | _        g | _        y r"   )r$   r   STREAM_CLOSEDr   _eventsr6   s     r   r'   zStreamClosedError.__init__q   s!    " %22 r   Nr7   r8   r   r   r   r:   r:   i   s    	r   r:   c                  $     e Zd ZdZd fdZ xZS )InvalidSettingsValueErrorz\
    An attempt was made to set an invalid Settings value.

    .. versionadded:: 2.0.0
    c                2    t         |   |       || _        y r"   )superr'   r   )r&   msgr   	__class__s      r   r'   z"InvalidSettingsValueError.__init__   s    $r   )rB   r/   r   r   r,   r-   )r	   r
   r   r   r'   __classcell__)rC   s   @r   r?   r?   }   s    % %r   r?   c                       e Zd ZdZddZddZy)InvalidBodyLengthErrorz{
    The remote peer sent more or less data that the Content-Length header
    indicated.

    .. versionadded:: 2.0.0
    c                     || _         || _        y r"   expected_lengthactual_length)r&   expectedactuals      r   r'   zInvalidBodyLengthError.__init__   s    '#r   c                :    d| j                    d| j                   S )Nz!InvalidBodyLengthError: Expected z bytes, received rH   r)   s    r   r*   zInvalidBodyLengthError.__str__   s%    243G3G2HHYZ^ZlZlYmnnr   N)rK   r+   rL   r+   r,   r-   r.   r0   r   r   r   rF   rF      s    $or   rF   c                      e Zd ZdZy)UnsupportedFrameErrorz
    The remote peer sent a frame that is unsupported in this context.

    .. versionadded:: 2.1.0

    .. versionchanged:: 4.0.0
       Removed deprecated KeyError parent class.
    Nr   r   r   r   rO   rO      s    r   rO   c                      e Zd ZdZy)RFC1122Errora  
    Emitted when users attempt to do something that is literally allowed by the
    relevant RFC, but is sufficiently ill-defined that it's unwise to allow
    users to actually do it.

    While there is some disagreement about whether or not we should be liberal
    in what accept, it is a truth universally acknowledged that we should be
    conservative in what emit.

    .. versionadded:: 2.4.0
    Nr   r   r   r   rQ   rQ      s    
r   rQ   c                  (    e Zd ZdZej
                  Zy)DenialOfServiceErrora@  
    Emitted when the remote peer exhibits a behaviour that is likely to be an
    attempt to perform a Denial of Service attack on the implementation. This
    is a form of ProtocolError that carries a different error code, and allows
    more easy detection of this kind of behaviour.

    .. versionadded:: 2.5.0
    N)r	   r
   r   r   r   ENHANCE_YOUR_CALMr   r   r   r   rS   rS      s     --Jr   rS   N)r   
__future__r   errorsr   	Exceptionr   r   r   r   r   r   r    r2   r4   r:   
ValueErrorr?   rF   rO   rQ   rS   r   r   r   <module>rY      s    # i +G +- --M -- /} /[- ["} # #) (	%z 	%o] o M 7 ".= .r   