Skip to content

Commit 8515ef1

Browse files
committed
Update handling errors example
Use asyncio.sleep instead of time.sleep
1 parent e9e6c30 commit 8515ef1

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

docs/source/start/errors.rst

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,12 @@ The value is stored in the ``x`` attribute of the exception object:
9696

9797
.. code-block:: python
9898
99-
import time
99+
import asyncio
100100
from pyrogram.errors import FloodWait
101101
102-
try:
103-
... # Your code
104-
except FloodWait as e:
105-
time.sleep(e.x) # Wait "x" seconds before continuing
102+
...
103+
try:
104+
... # Your code
105+
except FloodWait as e:
106+
await asyncio.sleep(e.x) # Wait "x" seconds before continuing
107+
...

0 commit comments

Comments
 (0)