mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-11-10 19:10:37 +00:00
Make readthedocs build run without warnings
This commit is contained in:
@@ -1095,22 +1095,22 @@ class MessageDeleted(_EventBuilder):
|
||||
|
||||
class StopPropagation(Exception):
|
||||
"""
|
||||
If this Exception is found to be raised in any of the handlers for a
|
||||
given update, it will stop the execution of all other registered
|
||||
event handlers in the chain.
|
||||
Think of it like a ``StopIteration`` exception in a for loop.
|
||||
If this exception is raised in any of the handlers for a given event,
|
||||
it will stop the execution of all other registered event handlers.
|
||||
It can be seen as the ``StopIteration`` in a for loop but for events.
|
||||
|
||||
Example usage:
|
||||
```
|
||||
@client.on(events.NewMessage)
|
||||
def delete(event):
|
||||
event.delete()
|
||||
# Other handlers won't have an event to work with
|
||||
raise StopPropagation
|
||||
|
||||
@client.on(events.NewMessage)
|
||||
def _(event):
|
||||
# Will never be reached, because it is the second handler in the chain.
|
||||
pass
|
||||
```
|
||||
>>> @client.on(events.NewMessage)
|
||||
... def delete(event):
|
||||
... event.delete()
|
||||
... # No other event handler will have a chance to handle this event
|
||||
... raise StopPropagation
|
||||
...
|
||||
>>> @client.on(events.NewMessage)
|
||||
... def _(event):
|
||||
... # Will never be reached, because it is the second handler
|
||||
... pass
|
||||
"""
|
||||
# For some reason Sphinx wants the silly >>> or
|
||||
# it will show warnings and look bad when generated.
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user