HEX
Server: Apache
System: Linux 185.122.168.184.host.secureserver.net 5.14.0-570.60.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Nov 5 05:00:59 EST 2025 x86_64
User: barbeatleanalyti (1024)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //var/opt/nydus/ops/mysql/connector/__pycache__/errors.cpython-39.pyc
a

�,�h�-� @sbUdZddlmZmZmZmZmZmZddlm	Z	ddl
mZddlm
Z
mZGdd�de�ZGd	d
�d
e�ZGdd�de�ZGd
d�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�Zeeeeeeeeeeeeeeeeeeeeef
ZeeeeeeeeeeeefZiaeeefed<d-eeeeeeeffeeeeeefd�d d!�Z d.eee!ee!ee"ed#�d$d%�Z#e$ed&�d'd(�Z%eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed)�Z&ee!efed*<eeeeeeeed+�Z'eeefed,<dS)/zPython exceptions.�)�Dict�Mapping�Optional�Tuple�Type�Union�)�get_client_error)�
StrOrBytes)�
read_bytes�read_intcs^eZdZdZd
eeeeeeeeefdfeedd��fdd�
Z	ed�dd	�Z
�ZS)�Errorz�Exception that is base class for all other error exceptions.

    See [1] for more details.

    References:
        [1]: https://dev.mysql.com/doc/connector-python/en/connector-python-api-errors-error.html
    N.)�msg�errno�values�sqlstate�returnc
st���||_|j|_|pd|_||_|js�d|jkrDdkr�nn`t|j�|_|dur�z|j||_Wq�ty�}z |j�d|�d�|_WYd}~q�d}~00n|js�d|_|_|j�r|jdk�r|j|jd�}|jr�d}|j|d	<nd
}|jfi|��|_|j|j|jf|_	dS)N���i�i�z (Warning: �)z
Unknown error)rrz{errno} ({state}): {msg}�statez{errno}: {msg})
�super�__init__r�	_full_msgrrr	�	TypeError�format�args)�selfrrrr�err�fields�fmt��	__class__��I/opt/nydus/tmp/pip-target-wkfpz8uv/lib64/python/mysql/connector/errors.pyr.s,

 ,zError.__init__)rcCs|jS)N)r)rr"r"r#�__str__Psz
Error.__str__)NNNN)�__name__�
__module__�__qualname__�__doc__r�str�intrrrr$�
__classcell__r"r"r r#r
%s
��"r
c@seZdZdZdS)�Warningz Exception for important warningsN�r%r&r'r(r"r"r"r#r,Tsr,c@seZdZdZdS)�InterfaceErrorz-Exception for errors related to the interfaceNr-r"r"r"r#r.Xsr.c@seZdZdZdS)�
DatabaseErrorz,Exception for errors related to the databaseNr-r"r"r"r#r/\sr/c@seZdZdZdS)�
InternalErrorz-Exception for errors internal database errorsNr-r"r"r"r#r0`sr0c@seZdZdZdS)�OperationalErrorz8Exception for errors related to the database's operationNr-r"r"r"r#r1dsr1c@seZdZdZdS)�ProgrammingErrorz'Exception for errors programming errorsNr-r"r"r"r#r2hsr2c@seZdZdZdS)�IntegrityErrorz3Exception for errors regarding relational integrityNr-r"r"r"r#r3lsr3c@seZdZdZdS)�	DataErrorz;Exception for errors reporting problems with processed dataNr-r"r"r"r#r4psr4c@seZdZdZdS)�NotSupportedErrorzBException for errors when an unsupported database feature was usedNr-r"r"r"r#r5tsr5c@seZdZdZdS)�	PoolErrorz3Exception for errors relating to connection poolingNr-r"r"r"r#r6xsr6�_CUSTOM_ERROR_EXCEPTIONSN)�error�	exceptionrcCs�t|t�r|siatS|s"|s"tSt|ttf�s8td��t|t�rJ||i}|��D]l\}}t|t�sltd��z|dus�t|t�s�t�Wn.ty�}ztd�|�WYd}~n
d}~00|t|<qRtS)a�Defines custom exceptions for MySQL server errors.

    This function defines custom exceptions for MySQL server errors and
    returns the current set customizations.

    To reset the customizations, simply supply an empty dictionary.

    Args:
        error: Can be a MySQL Server error number or a dictionary in which case the
               key is the server error number and the value is the exception to be raised.
        exception: If `error` is a MySQL Server error number then you have to pass
                   also the exception class, otherwise you don't.

    Returns:
        dictionary: Current set customizations.

    Examples:
        ```
        import mysql.connector
        from mysql.connector import errorcode

        # Server error 1028 should raise a DatabaseError
        mysql.connector.custom_error_exception(
            1028, mysql.connector.DatabaseError)

        # Or using a dictionary:
        mysql.connector.custom_error_exception({
            1028: mysql.connector.DatabaseError,
            1029: mysql.connector.OperationalError,
            })

        # Reset
        mysql.connector.custom_error_exception({})
        ```
    z<The error argument should be either an integer or dictionaryz!Error number should be an integerNz)Exception should be subclass of Exception)	�
isinstance�dictr7r*�
ValueError�items�
issubclass�	Exceptionr)r8r9r�
_exceptionrr"r"r#�custom_error_exception�s&)

 
rAF)rrr�warningrcCs�zt||||d�WSty&Yn0zt||||d�WStyNYn0|sn|rbt||�St||d�Szt|dd�|||d�WSty�t|||d�YS0dS)a>Get the exception matching the MySQL error

    This function will return an exception based on the SQLState. The given
    message will be passed on in the returned exception.

    The exception returned can be customized using the
    mysql.connector.custom_error_exception() function.

    Returns an Exception
    )rrr)rrr�N)r7�KeyError�_ERROR_EXCEPTIONSr,r/�_SQLSTATE_CLASS_EXCEPTION)rrrrBr"r"r#�get_mysql_exception�s$
�rG)�packetrc
Csd}}z|ddkrtd��Wn4tyT}ztd|�d��WYd}~Sd}~00d}zt|dd�}t|d�\}}|d	d
kr�t|ttf�r�|�d�}q�|}n*t|dd�d�\}}|�d�}|�d�}Wn:tt	f�y}ztd|�d��WYd}~Sd}~00t
|||�S)
z�Returns an exception object based on the MySQL error

    Returns an exception object based on the MySQL error in the given
    packet.

    Returns an Error-Object.
    N��zPacket is not an error packetz"Failed getting Error information (r�rCr�#�utf8r)r<�
IndexErrorr.rr:�bytes�	bytearray�decoder�UnicodeErrorrG)rHr�errmsgrrr"r"r#�
get_exceptions(&
&rT)�02Z07Z08Z0AZ21Z22Z23Z24Z25Z26�27Z28Z2AZ2BZ2CZ2DZ2EZ33Z34Z35Z37Z3CZ3DZ3FZ40Z42Z44ZHZZXAZ0KZHYrF)i�i�i�i�iii
i�rE)NN)NNF)(r(�typingrrrrrrZlocalesr	�typesr
�utilsrrr?r
r,r.r/r0r1r2r3r4r5r6ZErrorClassTypesZ
ErrorTypesr7r*�__annotations__rAr)�boolrGrOrTrFrEr"r"r"r#�<module>s� /������E��*$�#�