File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1717# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818
1919from collections .abc import Sequence
20- from typing import Callable
20+ from typing import Callable , Optional
2121
2222import pyrogram
2323from pyrogram .filters import Filter
@@ -78,14 +78,13 @@ class ErrorHandler(Handler):
7878 def __init__ (
7979 self ,
8080 callback : Callable ,
81- filters : Filter | None = None ,
82- exceptions : Exception | Sequence [Exception ] | None = None
81+ filters : Optional [ Filter ] = None ,
82+ exceptions : Optional [ type [ Exception ] | Sequence [type [ Exception ]]] = None
8383 ):
8484 super ().__init__ (callback , filters )
8585
86- exceptions = exceptions or (Exception ,)
87- if not isinstance (exceptions , tuple ):
88- exceptions = (exceptions ,)
89-
90- self .exceptions = exceptions
91-
86+ self .exceptions : tuple [Exception ] = (
87+ tuple (exceptions )
88+ if isinstance (exceptions , Sequence )
89+ else exceptions or (Exception ,)
90+ )
You can’t perform that action at this time.
0 commit comments