Build a much cleaner errors reference page

This commit is contained in:
Dan 2019-05-13 15:57:49 +02:00
parent ef912d21ef
commit 0e80b39c2c
11 changed files with 62 additions and 73 deletions

View File

@ -1,28 +1,73 @@
RPC Errors
==========
All the Pyrogram errors listed here live inside the ``errors`` sub-package.
All Pyrogram API errors live inside the ``errors`` sub-package: ``pyrogram.errors``.
The errors ids listed here are shown as *UPPER_SNAKE_CASE*, but the actual exception names to import from Pyrogram
follow the usual *PascalCase* convention.
**Example:**
**Example**:
.. code-block:: python
from pyrogram.errors import RPCError
from pyrogram.errors import InternalServerError
try:
...
except RPCError:
except FloodWait:
...
.. autoexception:: pyrogram.RPCError()
:members:
303 - See Other
---------------
.. toctree::
../errors/see-other
../errors/bad-request
../errors/unauthorized
../errors/forbidden
../errors/not-acceptable
../errors/flood
../errors/internal-server-error
../errors/unknown-error
.. csv-table::
:file: ../../../compiler/error/source/303_SEE_OTHER.tsv
:delim: tab
:header-rows: 1
400 - Bad Request
-----------------
.. csv-table::
:file: ../../../compiler/error/source/400_BAD_REQUEST.tsv
:delim: tab
:header-rows: 1
401 - Unauthorized
------------------
.. csv-table::
:file: ../../../compiler/error/source/401_UNAUTHORIZED.tsv
:delim: tab
:header-rows: 1
403 - Forbidden
---------------
.. csv-table::
:file: ../../../compiler/error/source/403_FORBIDDEN.tsv
:delim: tab
:header-rows: 1
406 - Not Acceptable
--------------------
.. csv-table::
:file: ../../../compiler/error/source/406_NOT_ACCEPTABLE.tsv
:delim: tab
:header-rows: 1
420 - Flood
-----------
.. csv-table::
:file: ../../../compiler/error/source/420_FLOOD.tsv
:delim: tab
:header-rows: 1
500 - Internal Server Error
---------------------------
.. csv-table::
:file: ../../../compiler/error/source/500_INTERNAL_SERVER_ERROR.tsv
:delim: tab
:header-rows: 1

View File

@ -1,7 +0,0 @@
400 - Bad Request
=================
.. module:: pyrogram.errors.BadRequest
.. automodule:: pyrogram.errors.exceptions.bad_request_400
:members:

View File

@ -1,7 +0,0 @@
420 - Flood
===========
.. module:: pyrogram.errors.Flood
.. automodule:: pyrogram.errors.exceptions.flood_420
:members:

View File

@ -1,7 +0,0 @@
403 - Forbidden
===============
.. module:: pyrogram.errors.Forbidden
.. automodule:: pyrogram.errors.exceptions.forbidden_403
:members:

View File

@ -1,7 +0,0 @@
500 - Internal Server Error
===========================
.. module:: pyrogram.errors.InternalServerError
.. automodule:: pyrogram.errors.exceptions.internal_server_error_500
:members:

View File

@ -1,7 +0,0 @@
406 - Not Acceptable
====================
.. module:: pyrogram.errors.NotAcceptable
.. automodule:: pyrogram.errors.exceptions.not_acceptable_406
:members:

View File

@ -1,7 +0,0 @@
303 - See Other
===============
.. module:: pyrogram.errors.SeeOther
.. automodule:: pyrogram.errors.exceptions.see_other_303
:members:

View File

@ -1,7 +0,0 @@
401 - Unauthorized
==================
.. module:: pyrogram.errors.Unauthorized
.. automodule:: pyrogram.errors.exceptions.unauthorized_401
:members:

View File

@ -1,7 +0,0 @@
520 - Unknown Error
===================
.. module:: pyrogram.errors.UnknownError
.. autoexception:: pyrogram.errors.rpc_error.UnknownError
:members:

View File

@ -68,7 +68,7 @@ in a bunch of seconds:
I keep getting [400 PEER_ID_INVALID] error!
-------------------------------------------
The error in question is ``[400 PEER_ID_INVALID]: The id/access_hash combination is invalid``, and could mean several
The error in question is **[400 PEER_ID_INVALID]: The id/access_hash combination is invalid**, and could mean several
things:
- The chat id you tried to use is simply wrong, double check it.