o
    Xzj{  ã                   @   sX   d Z ddlZddlmZmZmZmZmZmZm	Z	m
Z
mZmZ ddlT ddlT dd„ ZdS )z‹
This module holds all the base and automatically generated errors that the
Telegram API has. See telethon_generator/errors.json for more.
é    Né   )
ÚReadCancelledErrorÚTypeNotFoundErrorÚInvalidChecksumErrorÚInvalidBufferErrorÚAuthKeyNotFoundÚSecurityErrorÚCdnFileTamperedErrorÚAlreadyInConversationErrorÚBadMessageErrorÚ
MultiError)Ú*c                 C   sŽ   t  | j ¡ d¡}|r||d�S tD ]"\}}t || j¡}|r4| ¡ r*t| 	d¡ƒnd}|||d�  S qt
 t| jƒt¡}||| j| jd�S )zî
    Converts a Telegram's RPC Error to a Python error.

    :param rpc_error: the RpcError instance.
    :param request: the request that caused this error.
    :return: the RPCError as a Python exception that represents this error.
    N)Úrequestr   )r   Úcapture)r   ÚmessageÚcode)Úrpc_errors_dictÚgetÚerror_messageÚupperÚrpc_errors_reÚreÚmatchÚgroupsÚintÚgroupÚbase_errorsÚabsÚ
error_codeÚRPCError)Ú	rpc_errorr   ÚclsÚ	msg_regexÚmr   © r$   úS/var/www/kodo/tsheker/venv/lib/python3.10/site-packages/telethon/errors/__init__.pyÚrpc_message_to_error   s   

þ
ÿr&   )Ú__doc__r   Úcommonr   r   r   r   r   r   r	   r
   r   r   ÚrpcbaseerrorsÚrpcerrorlistr&   r$   r$   r$   r%   Ú<module>   s    0