
    j]                     .   d 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dS )z1 Internal module for all Bolt exception classes.
    )strerrorc                   "     e Zd ZdZ fdZ xZS )	BoltErrorz. Base class for all Bolt protocol errors.
    c                 X    t                                          |           || _        d S N)super__init__address)selfmessager
   	__class__s      [/lsinfo/ai/hellotax_ai/base_platform/venv/lib/python3.11/site-packages/neo4j/_exceptions.pyr	   zBoltError.__init__   s&    !!!    __name__
__module____qualname____doc__r	   __classcell__r   s   @r   r   r      sB                 r   r   c                   B     e Zd ZdZ fdZ fdZed             Z xZS )BoltConnectionErrorz% Raised when a connection fails.
    c                 v    d}t                                          |                    |          |           d S )NzConnection Failed. Please ensure that your database is listening on the correct host and port and that you have enabled encryption if required. Note that the default encryption setting has changed in Neo4j 4.0. See the docs for more information. {})r   r	   format)r   r   r
   msgr   s       r   r	   zBoltConnectionError.__init__%   s;    	 	 	G,,g66666r   c                     t                                                      }| j        }|r&|d                    |t	          |                    z  }|S )Nz (code {}: {}))r   __str__errnor   r   )r   sr   r   s      r   r   zBoltConnectionError.__str__.   sL    GGOO
 	A!((@@@Ar   c                 >    	 | j         j        S # t          $ r Y d S w xY wr   )	__cause__r   AttributeErrorr   s    r   r   zBoltConnectionError.errno5   s4    	>'' 	 	 	44	    
)	r   r   r   r   r	   r   propertyr   r   r   s   @r   r   r   !   sv         7 7 7 7 7       X    r   r   c                   "     e Zd ZdZ fdZ xZS )BoltSecurityErrorz: Raised when a connection fails for security reasons.
    c                     d                     | j        j        j        t	                                                                S )Nz[{}] {})r   r!   r   r   r   r   r   r   s    r   r   zBoltSecurityError.__str__A   s/     8 A577??CTCTUUUr   )r   r   r   r   r   r   r   s   @r   r'   r'   =   sK         V V V V V V V V Vr   r'   c                       e Zd ZdZdS )BoltConnectionBrokenz Raised when an established connection is lost or when an
    attempt is made to use a connection that has previously broken.
    Nr   r   r   r    r   r   r+   r+   E              r   r+   c                       e Zd ZdZdS )BoltConnectionClosedzZ Raised when an attempt is made to use a connection that has
    been closed locally.
    Nr,   r-   r   r   r0   r0   M   r.   r   r0   c                   "     e Zd ZdZ fdZ xZS )BoltHandshakeErrorz7 Raised when a handshake completes unsuccessfully.
    c                 h    t                                          ||           || _        || _        d S r   )r   r	   request_dataresponse_data)r   r   r
   r4   r5   r   s        r   r	   zBoltHandshakeError.__init__W   s3    '***(*r   r   r   s   @r   r2   r2   S   sB         + + + + + + + + +r   r2   c                       e Zd ZdZdS )BoltTransactionErrorzc Raised when a fault occurs with a transaction, or when a
    transaction is used incorrectly.
    Nr,   r-   r   r   r7   r7   ]   r.   r   r7   c                        e Zd ZdZdZdZdZdZdZe	d
d            Z
 fdZ fdZ fdZed             Zed	             Z xZS )BoltFailurez Holds a Cypher failure.
    NFc                 r    t          | d          r&|                                 D ]} ||          r|c S |S )N__subclasses__)hasattrr;   )cls	predicatedefaultsubclasss       r   _find_subclasszBoltFailure._find_subclassy   sU    3()) 	$..00 $ $9X&& $#OOO$r   c                 4                        d          }|d         |                     fd|           }t          ||           sJ |                    fd|          }t          ||          sJ t                                          |||          S )N.   c                     | j         k    S r   )r   )kclassifications    r   <lambda>z%BoltFailure.__new__.<locals>.<lambda>   s    !**F r   c                     | j         k    S r   )code)rF   rJ   s    r   rH   z%BoltFailure.__new__.<locals>.<lambda>   s    4 r   )splitrA   
issubclassr   __new__)
r=   r   r
   rJ   response
code_partsc1c2rG   r   s
      `    @r   rM   zBoltFailure.__new__   s    ZZ__
#A F F F FLL"c"""""7777<<"b!!!!!wwr7G444r   c                     t                                          ||           || _        | j                            d          }|d         | _        |d         | _        |d         | _        || _        d S )NrC   rD         )r   r	   rJ   rK   rG   categorytitlerN   )r   r   r
   rJ   rN   rO   r   s         r   r	   zBoltFailure.__init__   sd    '***	Y__S))
(m"1]
 r   c                     d                     | j        | j        t                                                                S )Nz
[{}.{}] {})r   rU   rV   r   r   r)   s    r   r   zBoltFailure.__str__   s-    ""4=$*eggoo>O>OPPPr   c                 >    	 | j         j        S # t          $ r Y dS w xY w)zG The Result object to which this failure is attached (if any).
        N)rN   resultr"   r#   s    r   rY   zBoltFailure.result   s4    	='' 	 	 	44	r$   c                 >    	 | j         j        S # t          $ r Y d S w xY wr   )rY   transactionr"   r#   s    r   r[   zBoltFailure.transaction   s4    	;** 	 	 	44	r$   r   )r   r   r   r   rJ   rG   rU   rV   	transientclassmethodrA   rM   r	   r   r%   rY   r[   r   r   s   @r   r9   r9   d   s          D N H E
 I   [5 5 5 5 5! ! ! ! !Q Q Q Q Q   X   X    r   r9   c                       e Zd ZdZdS )BoltProtocolErrorzE Raised when an unexpected or unsupported protocol event occurs.
    Nr,   r-   r   r   r_   r_      s           r   r_   c                       e Zd ZdZdS )SocketDeadlineExceededz9Raised from sockets with deadlines when a timeout occurs.Nr,   r-   r   r   ra   ra      s        CCCCr   ra   N)r   osr   	Exceptionr   r   r'   r+   r0   r2   r7   r9   r_   RuntimeErrorra   r-   r   r   <module>re      s  "           	       )   8V V V V V+ V V V    .       .   + + + + + + + +    9   @ @ @ @ @) @ @ @F    	   
D D D D D\ D D D D Dr   