Ë
    :É„jd  ã                  ó^   — d dl mZ d dlmZ d dlmZ ddlmZ d dlZd dl	m
Z
  G d„ d	e«      Zy)
é    )Úannotations)ÚIterable)ÚCallableé   )ÚHandlerN)ÚUpdatec                  ó>   ‡ — e Zd ZdZ	 d	 	 	 dˆ fd„Zdd„Zdd„Zˆ xZS )	ÚErrorHandleraü  The Error handler class. Used to handle errors.
    It is intended to be used with :meth:`~pyrogram.Client.add_handler`

    For a nicer way to register this handler, have a look at the
    :meth:`~pyrogram.Client.on_error` decorator.

    Parameters:
        callback (``Callable``):
            Pass a function that will be called when a new Error arrives. It takes *(client, error)*
            as positional arguments (look at the section below for a detailed description).

        exceptions (``Exception`` | Iterable of ``Exception``, *optional*):
            Pass one or more exception classes to allow only a subset of errors to be passed
            in your callback function.

    Other parameters:
        client (:obj:`~pyrogram.Client`):
            The Client itself, useful when you want to call other API methods inside the error handler.

        update (:obj:`~pyrogram.Update`):
            The update that caused the error.

        error (``Exception``):
            The error that was raised.
    c                ó|   •— t        |t        «      rt        |«      n|r|fnt        f| _        t
        ‰| �  |«       y ©N)Ú
isinstancer   ÚtupleÚ	ExceptionÚ
exceptionsÚsuperÚ__init__)ÚselfÚcallbackr   Ú	__class__s      €úV/var/www/html/GAP/venv/lib/python3.12/site-packages/pyrogram/handlers/error_handler.pyr   zErrorHandler.__init__:   s@   ø€ ô ˜*¤hÔ/ô �*Ôñ ð ‘ä�ð 	Œô 	‰Ñ˜Õ"ó    c              ƒ  ót   K  — t        || j                  «      r| j                  |||«      ƒ d {  –—†  yy7 Œ­w)NTF)r   r   r   )r   ÚclientÚupdateÚ	exceptions       r   ÚcheckzErrorHandler.checkH   s5   è ø€ Ü�i §¡Ô1Ø—-‘- ¨°	Ó:×:Ð:ØØð ;ús   ‚-8¯6°8c                ó.   — t        || j                  «      S r   )r   r   )r   Úerrors     r   Úcheck_removezErrorHandler.check_removeN   s   € Ü˜% §¡Ó1Ð1r   r   )r   r   r   z2type[Exception] | Iterable[type[Exception]] | None)r   zpyrogram.Clientr   r   r   r   ÚreturnÚbool)r   z+type[Exception] | Iterable[type[Exception]]r    r!   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   Ú__classcell__)r   s   @r   r
   r
      s1   ø„ ñð: JNð#àð#ð Gõ#ó÷2r   r
   )Ú
__future__r   Úcollections.abcr   Útypingr   Úhandlerr   ÚpyrogramÚpyrogram.typesr   r
   © r   r   ú<module>r.      s%   ðõ( #å $Ý å ã Ý !ô02�7õ 02r   