Skip to content

Commit

Permalink
Update handling errors example
Browse files Browse the repository at this point in the history
Use asyncio.sleep instead of time.sleep
  • Loading branch information
delivrance committed May 5, 2021
1 parent e9e6c30 commit 8515ef1
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions docs/source/start/errors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,12 @@ The value is stored in the ``x`` attribute of the exception object:

.. code-block:: python
import time
import asyncio
from pyrogram.errors import FloodWait
try:
... # Your code
except FloodWait as e:
time.sleep(e.x) # Wait "x" seconds before continuing
...
try:
... # Your code
except FloodWait as e:
await asyncio.sleep(e.x) # Wait "x" seconds before continuing
...

0 comments on commit 8515ef1

Please sign in to comment.