
    soj7                         d Z  G d de          Z G d de          Z G d de          Z G d de          Z G d	 d
e          Z G d de          Z G d de          Z G d de          Z	dS )a  
Drop-in replacements for the ``telegram.error`` exception hierarchy, so that
every ``except BadRequest`` / ``except Forbidden`` / ``except TelegramError``
clause in the original codebase keeps working unchanged.

These are pure Python exception classes - they carry no Telethon-specific
behaviour. All the translation from real Telethon/MTProto errors into these
types happens in ``src/tg_compat/_bot.py``.
c                   0     e Zd ZdZddef fdZd Z xZS )TelegramErrorzQBase class for all compat Telegram errors (mirrors telegram.error.TelegramError). messagec                 X    || _         t                                          |           d S N)r   super__init__selfr   	__class__s     /app/src/tg_compat/error.pyr	   zTelegramError.__init__   s(    !!!!!    c                     | j         S r   )r   )r   s    r   __str__zTelegramError.__str__   s
    |r   )r   )__name__
__module____qualname____doc__strr	   r   __classcell__r   s   @r   r   r      s^        [[" " " " " " " "      r   r   c                       e Zd ZdZdS )
BadRequestzDMirrors telegram.error.BadRequest (Bot API 'Bad Request' responses).Nr   r   r   r    r   r   r   r      s        NNNNr   r   c                       e Zd ZdZdS )	ForbiddenzKMirrors telegram.error.Forbidden (bot was blocked / kicked / lacks rights).Nr   r   r   r   r   r      s        UUUUr   r   c                   *     e Zd ZdZddef fdZ xZS )TimedOutz4Mirrors telegram.error.TimedOut (request timed out).	Timed outr   c                 J    t                                          |           d S r   )r   r	   r
   s     r   r	   zTimedOut.__init__"   s!    !!!!!r   )r    )r   r   r   r   r   r	   r   r   s   @r   r   r      sO        >>" " " " " " " " " " " "r   r   c                       e Zd ZdZdS )NetworkErrorz@Mirrors telegram.error.NetworkError (connection-level failures).Nr   r   r   r   r#   r#   &   s        JJJJr   r#   c                   "     e Zd ZdZ fdZ xZS )
RetryAfterz2Mirrors telegram.error.RetryAfter (flood control).c                 `    || _         t                                          d| d           d S )Nz!Flood control exceeded. Retry in z seconds)retry_afterr   r	   )r   r'   r   s     r   r	   zRetryAfter.__init__-   s5    &R[RRRSSSSSr   )r   r   r   r   r	   r   r   s   @r   r%   r%   *   sG        <<T T T T T T T T Tr   r%   c                   (     e Zd ZdZdef fdZ xZS )ChatMigratedzIMirrors telegram.error.ChatMigrated (basic group upgraded to supergroup).new_chat_idc                 ^    || _         t                                          d|            d S )NzGroup migrated to supergroup )r*   r   r	   )r   r*   r   s     r   r	   zChatMigrated.__init__5   s2    &FFFGGGGGr   )r   r   r   r   intr	   r   r   s   @r   r)   r)   2   sU        SSHC H H H H H H H H H Hr   r)   c                       e Zd ZdZdS )InvalidTokenz$Mirrors telegram.error.InvalidToken.Nr   r   r   r   r.   r.   :   s        ....r   r.   N)
r   	Exceptionr   r   r   r   r#   r%   r)   r.   r   r   r   <module>r0      s       I   O O O O O O O OV V V V V V V V" " " " "} " " "K K K K K= K K KT T T T T T T TH H H H H= H H H/ / / / /= / / / / /r   