Skip to content

Commit 0e80b39

Browse files
committed
Build a much cleaner errors reference page
1 parent ef912d2 commit 0e80b39

11 files changed

Lines changed: 63 additions & 74 deletions

File tree

docs/source/api/errors.rst

Lines changed: 61 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,73 @@
11
RPC Errors
22
==========
33

4-
All the Pyrogram errors listed here live inside the ``errors`` sub-package.
4+
All Pyrogram API errors live inside the ``errors`` sub-package: ``pyrogram.errors``.
5+
The errors ids listed here are shown as *UPPER_SNAKE_CASE*, but the actual exception names to import from Pyrogram
6+
follow the usual *PascalCase* convention.
57

6-
**Example:**
8+
**Example**:
79

810
.. code-block:: python
911
10-
from pyrogram.errors import RPCError
12+
from pyrogram.errors import InternalServerError
1113
1214
try:
1315
...
14-
except RPCError:
16+
except FloodWait:
1517
...
1618
17-
.. autoexception:: pyrogram.RPCError()
18-
:members:
19-
20-
.. toctree::
21-
../errors/see-other
22-
../errors/bad-request
23-
../errors/unauthorized
24-
../errors/forbidden
25-
../errors/not-acceptable
26-
../errors/flood
27-
../errors/internal-server-error
28-
../errors/unknown-error
19+
303 - See Other
20+
---------------
21+
22+
.. csv-table::
23+
:file: ../../../compiler/error/source/303_SEE_OTHER.tsv
24+
:delim: tab
25+
:header-rows: 1
26+
27+
400 - Bad Request
28+
-----------------
29+
30+
.. csv-table::
31+
:file: ../../../compiler/error/source/400_BAD_REQUEST.tsv
32+
:delim: tab
33+
:header-rows: 1
34+
35+
401 - Unauthorized
36+
------------------
37+
38+
.. csv-table::
39+
:file: ../../../compiler/error/source/401_UNAUTHORIZED.tsv
40+
:delim: tab
41+
:header-rows: 1
42+
43+
403 - Forbidden
44+
---------------
45+
46+
.. csv-table::
47+
:file: ../../../compiler/error/source/403_FORBIDDEN.tsv
48+
:delim: tab
49+
:header-rows: 1
50+
51+
406 - Not Acceptable
52+
--------------------
53+
54+
.. csv-table::
55+
:file: ../../../compiler/error/source/406_NOT_ACCEPTABLE.tsv
56+
:delim: tab
57+
:header-rows: 1
58+
59+
420 - Flood
60+
-----------
61+
62+
.. csv-table::
63+
:file: ../../../compiler/error/source/420_FLOOD.tsv
64+
:delim: tab
65+
:header-rows: 1
66+
67+
500 - Internal Server Error
68+
---------------------------
69+
70+
.. csv-table::
71+
:file: ../../../compiler/error/source/500_INTERNAL_SERVER_ERROR.tsv
72+
:delim: tab
73+
:header-rows: 1

docs/source/errors/bad-request.rst

Lines changed: 0 additions & 7 deletions
This file was deleted.

docs/source/errors/flood.rst

Lines changed: 0 additions & 7 deletions
This file was deleted.

docs/source/errors/forbidden.rst

Lines changed: 0 additions & 7 deletions
This file was deleted.

docs/source/errors/internal-server-error.rst

Lines changed: 0 additions & 7 deletions
This file was deleted.

docs/source/errors/not-acceptable.rst

Lines changed: 0 additions & 7 deletions
This file was deleted.

docs/source/errors/see-other.rst

Lines changed: 0 additions & 7 deletions
This file was deleted.

docs/source/errors/unauthorized.rst

Lines changed: 0 additions & 7 deletions
This file was deleted.

docs/source/errors/unknown-error.rst

Lines changed: 0 additions & 7 deletions
This file was deleted.

docs/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,4 +157,4 @@ Topics
157157
:caption: Telegram API
158158

159159
telegram/functions/index
160-
telegram/types/index
160+
telegram/types/index

0 commit comments

Comments
 (0)