U
     T‚gš  ã                   @   s|   d Z ddlZddlmZmZmZ G dd„ deƒZG dd„ deƒZG dd	„ d	eƒZ	ej
ee eg ef ed
 dœdd„ƒZdS )z
HAProxy specific exceptions.
é    N)ÚCallableÚ	GeneratorÚTypec                   @   s   e Zd ZdZdS )ÚInvalidProxyHeaderz8
    The provided PROXY protocol header is invalid.
    N©Ú__name__Ú
__module__Ú__qualname__Ú__doc__© r   r   úI/tmp/pip-unpacked-wheel-1_7di8ic/twisted/protocols/haproxy/_exceptions.pyr      s   r   c                   @   s   e Zd ZdZdS )ÚInvalidNetworkProtocolzC
    The network protocol was not one of TCP4 TCP6 or UNKNOWN.
    Nr   r   r   r   r   r      s   r   c                   @   s   e Zd ZdZdS )ÚMissingAddressDataz4
    The address data is missing or incomplete.
    Nr   r   r   r   r   r      s   r   )NNN)Ú
sourceTypeÚ
targetTypeÚreturnc              
   c   s@   z
dV  W n0 | k
r: } z|ƒ   |j¡‚W 5 d}~X Y nX dS )aA  
    Convert an error into a different error type.

    @param sourceType: The type of exception that should be caught and
        converted.
    @type sourceType: L{BaseException}

    @param targetType: The type of exception to which the original should be
        converted.
    @type targetType: L{BaseException}
    N)Úwith_tracebackÚ__traceback__)r   r   Úer   r   r   ÚconvertError   s    
r   )r
   Ú
contextlibÚtypingr   r   r   Ú	Exceptionr   r   r   ÚcontextmanagerÚBaseExceptionr   r   r   r   r   Ú<module>   s    
þ