U
    •uÄcÍ(  ã                   @   s
  d dl mZ d dlmZ dZeG dd„ deƒƒZeG dd„ deƒƒZeG dd	„ d	eƒƒZeG d
d„ deƒƒZ	eG dd„ deƒƒZ
eG dd„ deƒƒZeG dd„ deƒƒZeejƒG dd„ deƒƒZeejƒG dd„ deƒƒZeejƒG dd„ deƒƒZG dd„ deƒZdS )é    )Úpublic)Úerror)ÚErrorÚSessionNotReadyÚSerializationErrorÚInvalidUriErrorÚProtocolErrorÚTransportLostÚApplicationErrorÚNotAuthorizedÚ
InvalidUriÚInvalidPayloadÚTypeCheckErrorc                   @   s   e Zd ZdZdS )r   z8
    Base class for all exceptions related to WAMP.
    N©Ú__name__Ú
__module__Ú__qualname__Ú__doc__© r   r   ú[/var/www/html/CISBACKEND/school/venv/lib/python3.8/site-packages/autobahn/wamp/exception.pyr   .   s   r   c                   @   s   e Zd ZdZdS )r   zp
    The application tried to perform a WAMP interaction, but the
    session is not yet fully established.
    Nr   r   r   r   r   r   5   s   r   c                   @   s   e Zd ZdZdS )r   zœ
    Exception raised when the WAMP serializer could not serialize the
    application payload (``args`` or ``kwargs`` for ``CALL``, ``PUBLISH``, etc).
    Nr   r   r   r   r   r   =   s   r   c                   @   s   e Zd ZdZdS )r   z=
    Exception raised when an invalid WAMP URI was used.
    Nr   r   r   r   r   r   E   s   r   c                   @   s   e Zd ZdZdS )r   zÇ
    Exception raised when WAMP protocol was violated. Protocol errors
    are fatal and are handled by the WAMP implementation. They are
    not supposed to be handled at the application level.
    Nr   r   r   r   r   r   L   s   r   c                   @   s   e Zd ZdZdS )r	   zk
    Exception raised when the transport underlying the WAMP session
    was lost or is not connected.
    Nr   r   r   r   r   r	   U   s   r	   c                   @   s    e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdd„ Ze dd „ ƒZ!d!d"„ Z"d#d$„ Z#d%S )&r
   z]
    Base class for all exceptions that can/may be handled
    at the application level.
    zwamp.error.invalid_urizwamp.error.invalid_payloadz wamp.error.payload_size_exceededzwamp.error.no_such_procedurez#wamp.error.procedure_already_existsz<wamp.error.procedure_exists_with_different_invocation_policyzwamp.error.no_such_registrationzwamp.error.no_such_subscriptionzwamp.error.no_such_sessionzwamp.error.invalid_argumentzwamp.error.system_shutdownzwamp.error.close_realmzwamp.error.goodbye_and_outzwamp.error.not_authorizedzwamp.error.authorization_failedz wamp.error.authentication_failedzwamp.error.no_auth_methodzwamp.error.no_such_realmzwamp.error.no_such_rolezwamp.error.no_such_principalzwamp.error.canceledzwamp.error.timeoutzwamp.error.no_eligible_calleezwamp.error.no_payload_codecz*wamp.error.encryption.trusted_uri_mismatchz#wamp.error.encryption.decrypt_errorzwamp.error.type_check_errorc                 O   sf   t j| f|žŽ  || _|| _| dd¡| _| dd¡| _| dd¡| _| dd¡| _| dd¡| _	dS )z�

        :param error: The URI of the error that occurred, e.g. ``wamp.error.not_authorized``.
        :type error: str
        Úenc_algoNÚcalleeÚcallee_authidÚcallee_authroleÚforward_for)
Ú	ExceptionÚ__init__Úkwargsr   Úpopr   r   r   r   r   )Úselfr   Úargsr   r   r   r   r     s    zApplicationError.__init__c                 C   s    d  | jd dd„ | jD ƒ¡¡S )zt
        Get the error message of this exception.

        :returns: The error message.
        :rtype: str
        z{0}: {1}ú c                 S   s   g | ]}t |ƒ‘qS r   )Ústr)Ú.0Úar   r   r   Ú
<listcomp>  s     z2ApplicationError.error_message.<locals>.<listcomp>)Úformatr   Újoinr    ©r   r   r   r   Úerror_message  s    þzApplicationError.error_messagec                 C   sb   | j r0d| j kr0d| j  d¡ d }d| j d< nd}d | jt| jƒ| j | j| j| j| j	| j
|¡	S )NÚ	tracebackz:
Ú
z...Ú z‰ApplicationError(error=<{0}>, args={1}, kwargs={2}, enc_algo={3}, callee={4}, callee_authid={5}, callee_authrole={6}, forward_for={7}){8})r   r   r&   r   Úlistr    r   r   r   r   r   )r   Útbr   r   r   Ú__unicode__  s            ÿzApplicationError.__unicode__c                 C   s   |   ¡ S ©N)r/   r(   r   r   r   Ú__str__'  s    zApplicationError.__str__N)$r   r   r   r   ÚINVALID_URIÚINVALID_PAYLOADZPAYLOAD_SIZE_EXCEEDEDZNO_SUCH_PROCEDUREZPROCEDURE_ALREADY_EXISTSZ+PROCEDURE_EXISTS_INVOCATION_POLICY_CONFLICTZNO_SUCH_REGISTRATIONZNO_SUCH_SUBSCRIPTIONZNO_SUCH_SESSIONZINVALID_ARGUMENTZSYSTEM_SHUTDOWNZCLOSE_REALMZGOODBYE_AND_OUTÚNOT_AUTHORIZEDZAUTHORIZATION_FAILEDZAUTHENTICATION_FAILEDZNO_AUTH_METHODZNO_SUCH_REALMZNO_SUCH_ROLEZNO_SUCH_PRINCIPALZCANCELEDZTIMEOUTZNO_ELIGIBLE_CALLEEZENC_NO_PAYLOAD_CODECZENC_TRUSTED_URI_MISMATCHZENC_DECRYPT_ERRORÚTYPE_CHECK_ERRORr   r   r)   r/   r1   r   r   r   r   r
   ]   sB   	
	r
   c                   @   s   e Zd ZdZdS )r   z:
    Not authorized to perform the respective action.
    Nr   r   r   r   r   r   +  s   r   c                   @   s   e Zd ZdZdS )r   úJ
    The URI for a topic, procedure or error is not a valid WAMP URI.
    Nr   r   r   r   r   r   2  s   r   c                   @   s   e Zd ZdZdS )r   r6   Nr   r   r   r   r   r   9  s   r   c                       s    e Zd ZdZ‡ fdd„Z‡  ZS )r   z{
    The URI for a topic published with invalid argument types or a
    procedure called with invalid arguments types.
    c                    s   t ƒ jtjf|ž|Ž d S r0   )Úsuperr   r
   r5   )r   r    r   ©Ú	__class__r   r   r   E  s    zTypeCheckError.__init__)r   r   r   r   r   Ú__classcell__r   r   r8   r   r   @  s   r   N)Zautobahn.utilr   Zautobahn.wamp.urir   Ú__all__ÚRuntimeErrorr   r   r   r   r   r	   r
   r4   r   r   r2   r   r3   r   r   r   r   r   r   Ú<module>   s0    N