@@ -28,7 +28,7 @@ Error Categories
2828----------------
2929
3030The ``RPCError `` packs together all the possible errors Telegram could raise, but to make things tidier, Pyrogram
31- provides categories of errors, which are named after the common HTTP errors and subclass-ed from the RPCError:
31+ provides categories of errors, which are named after the common HTTP errors and are subclass-ed from the RPCError:
3232
3333.. code-block :: python
3434
@@ -71,14 +71,22 @@ RPCError, thus building a class of error hierarchy such as this:
7171Unknown Errors
7272--------------
7373
74- In case Pyrogram does not know anything yet about a specific error, it raises a special ``520 - UnknownError `` exception
75- and logs it in the ``unknown_errors.txt `` file. Users are invited to report these unknown errors.
74+ In case Pyrogram does not know anything about a specific error yet, it raises a generic error from its known category,
75+ for example, an unknown error with error code ``400 ``, will be raised as a ``BadRequest ``. This way you can catch the
76+ whole category of errors and be sure to also handle these unknown errors.
77+
78+ In case a whole class of errors is unknown (that is, an error code that is unknown), Pyrogram will raise a special
79+ ``520 UnknownError `` exception.
80+
81+ In both cases, Pyrogram will log them in the ``unknown_errors.txt `` file. Users are invited to report
82+ these unknown errors in the `discussion group <https://t.me/pyrogram >`_.
7683
7784Errors with Values
7885------------------
7986
8087Exception objects may also contain some informative values. For example, ``FloodWait `` holds the amount of seconds you
81- have to wait before you can try again. The value is always stored in the ``x `` field of the returned exception object:
88+ have to wait before you can try again, some other errors contain the DC number on which the request must be repeated on.
89+ The value is stored in the ``x `` attribute of the exception object:
8290
8391.. code-block :: python
8492
@@ -88,4 +96,4 @@ have to wait before you can try again. The value is always stored in the ``x`` f
8896 try :
8997 ...
9098 except FloodWait as e:
91- time.sleep(e.x) # Wait before trying again
99+ time.sleep(e.x) # Wait "x" seconds before continuing
0 commit comments