diff --git a/docs/source/errors/Forbidden.rst b/docs/source/errors/Forbidden.rst new file mode 100644 index 00000000..fd2e08ce --- /dev/null +++ b/docs/source/errors/Forbidden.rst @@ -0,0 +1,8 @@ +Forbidden +========= + +.. module:: pyrogram.api.errors.Forbidden + +.. automodule:: pyrogram.api.errors.exceptions.forbidden_403 + :members: + :show-inheritance: diff --git a/docs/source/errors/NotAcceptable.rst b/docs/source/errors/NotAcceptable.rst new file mode 100644 index 00000000..66ebaf72 --- /dev/null +++ b/docs/source/errors/NotAcceptable.rst @@ -0,0 +1,8 @@ +Not Acceptable +============== + +.. module:: pyrogram.api.errors.NotAcceptable + +.. automodule:: pyrogram.api.errors.exceptions.not_acceptable_406 + :members: + :show-inheritance: diff --git a/docs/source/pyrogram/Error.rst b/docs/source/pyrogram/Error.rst index b5474e73..2ec1159d 100644 --- a/docs/source/pyrogram/Error.rst +++ b/docs/source/pyrogram/Error.rst @@ -9,6 +9,8 @@ Error ../errors/SeeOther ../errors/BadRequest ../errors/Unauthorized + ../errors/Forbidden + ../errors/NotAcceptable ../errors/Flood ../errors/InternalServerError ../errors/UnknownError diff --git a/docs/source/resources/ErrorHandling.rst b/docs/source/resources/ErrorHandling.rst index 0d5cf6f9..f2a77b7a 100644 --- a/docs/source/resources/ErrorHandling.rst +++ b/docs/source/resources/ErrorHandling.rst @@ -1,15 +1,16 @@ Error Handling ============== -Errors are inevitable when working with the API, and they must be correctly handled by -the use of ``try..except`` blocks. +Errors are inevitable when working with the API, and they must be correctly handled with ``try..except`` blocks. -There are many errors that Telegram could return, but they all fall in one of these five exception categories +There are many errors that Telegram could return, but they all fall in one of these categories (which are in turn children of the :obj:`pyrogram.Error` superclass) - :obj:`303 See Other ` - :obj:`400 Bad Request ` - :obj:`401 Unauthorized ` +- :obj:`403 Forbidden ` +- :obj:`406 Not Acceptable ` - :obj:`420 Flood ` - :obj:`500 Internal Server Error ` @@ -56,5 +57,3 @@ before you can try again. The value is always stored in the ``x`` field of the r ... except FloodWait as e: time.sleep(e.x) - -**TODO: Better explanation on how to deal with exceptions** \ No newline at end of file