U
    h                  
   @   s   d dl mZ ejejejejejejejfZ	G dd de
ZG dd deZG dd deZG dd	 d	eZG d
d deZG dd deZG dd deZG dd deZG dd deZG dd deZeZdd eeeeeeeeef	D ZdS )   )	functionsc                       s>   e Zd ZdZdZdZd	 fdd	Zedd Zdd Z	  Z
S )
RPCErrorz0Base class for all Remote Procedure Call errors.Nc              	      s8   t  d|p| j|| | || _|| _|| _d S )NzRPCError {}: {}{})super__init__formatcode_fmt_requestrequestmessage)selfr	   r
   r   	__class__ A/tmp/pip-unpacked-wheel-c81u5j2r/telethon/errors/rpcbaseerrors.pyr      s    
  zRPCError.__init__c                 C   sP   d}d}t | tr2|d7 }|| jjd 7 }| j} q|| jjd|  7 }d|S )N        ()z (caused by {}))
isinstance_NESTS_QUERYr   __name__queryr   )r	   nreasonr   r   r   r      s    
zRPCError._fmt_requestc                 C   s   t | | j| j| jffS )N)typer	   r
   r   )r   r   r   r   
__reduce__&   s    zRPCError.__reduce__)N)r   
__module____qualname____doc__r   r
   r   staticmethodr   r   __classcell__r   r   r   r   r      s   
r   c                   @   s   e Zd ZdZdZdZdS )InvalidDCErrorzP
    The request must be repeated, but directed to a different data center.
    i/  ZERROR_SEE_OTHERNr   r   r   r   r   r
   r   r   r   r   r"   *   s   r"   c                   @   s   e Zd ZdZdZdZdS )BadRequestErrorz
    The query contains errors. In the event that a request was created
    using a form and contains user generated data, the user should be
    notified that the data must be corrected before the query is repeated.
    i  BAD_REQUESTNr#   r   r   r   r   r$   2   s   r$   c                   @   s   e Zd ZdZdZdZdS )UnauthorizedErrorzh
    There was an unauthorized attempt to use functionality available only
    to authorized users.
    i  UNAUTHORIZEDNr#   r   r   r   r   r&   <   s   r&   c                   @   s   e Zd ZdZdZdZdS )ForbiddenErrorz|
    Privacy violation. For example, an attempt to write a message to
    someone who has blacklisted the current user.
    i  	FORBIDDENNr#   r   r   r   r   r(   E   s   r(   c                   @   s   e Zd ZdZdZdZdS )NotFoundErrorzG
    An attempt to invoke a non-existent object, such as a method.
    i  	NOT_FOUNDNr#   r   r   r   r   r*   N   s   r*   c                   @   s   e Zd ZdZdZdZdS )AuthKeyErrorz{
    Errors related to invalid authorization key, like
    AUTH_KEY_DUPLICATED which can cause the connection to fail.
    i  ZAUTH_KEYNr#   r   r   r   r   r,   V   s   r,   c                   @   s   e Zd ZdZdZdZdS )
FloodErrorz
    The maximum allowed number of attempts to invoke the given method
    with the given input parameters has been exceeded. For example, in an
    attempt to request a large number of text messages (SMS) for the same
    phone number.
    i  ZFLOODNr#   r   r   r   r   r-   _   s   r-   c                   @   s   e Zd ZdZdZdZdS )ServerErrorz
    An internal server error occurred while a request was being processed
    for example, there was a disruption while accessing a database or file
    storage.
    i  ZINTERNALNr#   r   r   r   r   r.   j   s   r.   c                   @   s   e Zd ZdZdZdZdS )TimedOutErrorz
    Clicking the inline buttons of bots that never (or take to long to)
    call ``answerCallbackQuery`` will result in this "special" RPCError.
    i  TimeoutNr#   r   r   r   r   r/   t   s   r/   c                 C   s   i | ]}|j |qS r   )r   ).0xr   r   r   
<dictcomp>   s      r3   N)tlr   ZInvokeAfterMsgRequestZInvokeAfterMsgsRequestZInitConnectionRequestZInvokeWithLayerRequestZInvokeWithoutUpdatesRequestZInvokeWithMessagesRangeRequestZInvokeWithTakeoutRequestr   	Exceptionr   r"   r$   r&   r(   r*   r,   r-   r.   r/   Z
BotTimeoutZbase_errorsr   r   r   r   <module>   s<   

			
	       