
    (i                          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	y)c                       e Zd ZdZy)RLPExceptionz1Base class for exceptions raised by this package.N)__name__
__module____qualname____doc__     ?/var/www/br/venv/lib/python3.12/site-packages/rlp/exceptions.pyr   r      s    ;r	   r   c                   "     e Zd ZdZ fdZ xZS )EncodingErrorzb
    Exception raised if encoding fails.

    :ivar obj: the object that could not be encoded
    c                 2    t         |   |       || _        y Nsuper__init__objselfmessager   	__class__s      r
   r   zEncodingError.__init__       !r	   r   r   r   r   r   __classcell__r   s   @r
   r   r           r	   r   c                   "     e Zd ZdZ fdZ xZS )DecodingErrorzf
    Exception raised if decoding fails.

    :ivar rlp: the RLP string that could not be decoded
    c                 2    t         |   |       || _        y r   )r   r   rlp)r   r   r   r   s      r
   r   zDecodingError.__init__   r   r	   r   r   s   @r
   r   r      r   r	   r   c                   "     e Zd ZdZ fdZ xZS )SerializationErrorzj
    Exception raised if serialization fails.

    :ivar obj: the object that could not be serialized
    c                 2    t         |   |       || _        y r   r   r   s      r
   r   zSerializationError.__init__$   r   r	   r   r   s   @r
   r!   r!      r   r	   r!   c                   $     e Zd ZdZd fd	Z xZS )ListSerializationErrora  
    Exception raised if serialization by a :class:`sedes.List` fails.

    :ivar element_exception: the exception that occurred during the serialization of one
                             of the elements, or `None` if the error is unrelated to a
                             specific element
    :ivar index: the index in the list that produced the error or `None` if the error is
                 unrelated to a specific element
    c                 z    ||J |J d| dt        |       d}t        | 	  ||       || _        || _        y )Nz1Serialization failed because of element at index  ("")strr   r   indexelement_exception)r   r   r   r+   r*   r   s        r
   r   zListSerializationError.__init__4   se    ?$$$$000CE7 K*+,B0  	#&
!2r	   NNNNr   r   s   @r
   r$   r$   )       
3 
3r	   r$   c                   $     e Zd ZdZd fd	Z xZS )ObjectSerializationErrora  
    Exception raised if serialization of a :class:`sedes.Serializable` object fails.

    :ivar sedes: the :class:`sedes.Serializable` that failed
    :ivar list_exception: exception raised by the underlying list sedes, or `None` if no
                          such exception has been raised
    :ivar field: name of the field of the object that produced the error, or `None` if
                 no field responsible for the error
    c                    |f|J |j                   d }dt        |       d}nF|J |j                  j                  |j                     }d| dt        |j                          d}nd }t
        |   ||       || _        || _        y )Nz2Serialization failed because of underlying list ("r'   z&Serialization failed because of field r&   )	r+   r)   _metafield_namesr*   r   r   fieldlist_exception)r   r   r   sedesr4   r3   r   s         r
   r   z!ObjectSerializationError.__init__L   s    ?!---//7^,-R1 
 (((//0D0DE<UG D^==>?rC 
 E#&
,r	   r,   r   r   s   @r
   r/   r/   A   s    - -r	   r/   c                   "     e Zd ZdZ fdZ xZS )DeserializationErrorz}
    Exception raised if deserialization fails.

    :ivar serial: the decoded RLP string that could not be deserialized
    c                 2    t         |   |       || _        y r   )r   r   serial)r   r   r9   r   s      r
   r   zDeserializationError.__init__j   s    !r	   r   r   s   @r
   r7   r7   c   s     r	   r7   c                   $     e Zd ZdZd fd	Z xZS )ListDeserializationErrora  
    Exception raised if deserialization by a :class:`sedes.List` fails.

    :ivar element_exception: the exception that occurred during the deserialization of
                             one of the elements, or `None` if the error is unrelated to
                             a specific element
    :ivar index: the index in the list that produced the error or `None` if the error is
                 unrelated to a specific element
    c                 z    |s|J |J d| dt        |       d}t        | 	  ||       || _        || _        y )Nz3Deserialization failed because of element at index r&   r'   r(   )r   r   r9   r+   r*   r   s        r
   r   z!ListDeserializationError.__init__z   sc    $$$$000EeW M*+,B0  	&)
!2r	   r,   r   r   s   @r
   r;   r;   o   r-   r	   r;   c                   $     e Zd ZdZd fd	Z xZS )ObjectDeserializationErrora  
    Exception raised if deserialization by a :class:`sedes.Serializable` fails.

    :ivar sedes: the :class:`sedes.Serializable` that failed
    :ivar list_exception: exception raised by the underlying list sedes, or `None` if no
                          such exception has been raised
    :ivar field: name of the field of the object that produced the error, or `None` if
                 no field responsible for the error
    c                    |se|J |j                   d }dt        |       d}nC|J |j                  j                  |j                     }d| dt        |j                          d}t
        |   ||       || _        || _        | _	        y )Nz4Deserialization failed because of underlying list ("r'   z(Deserialization failed because of field r&   )
r+   r)   r1   r2   r*   r   r   r5   r4   r3   )r   r   r9   r5   r4   r3   r   s         r
   r   z#ObjectDeserializationError.__init__   s    !---//7^,-R1 
 (((//0D0DE>ug F^==>?rC  	&)
,
r	   r,   r   r   s   @r
   r>   r>      s     r	   r>   N)
	Exceptionr   r   r   r!   r$   r/   r7   r;   r>   r   r	   r
   <module>rA      sv   <9 <	L 		L 		 	3/ 30-1 -D	< 	33 30!5 r	   