From b4da453ef3b1a5193f7034604a195a9e58458195 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Wed, 27 Mar 2019 14:46:02 +0100 Subject: [PATCH] Documentation fixes --- docs/source/resources/ErrorHandling.rst | 24 +++++++++---------- .../types/messages_and_media/poll_option.py | 1 + 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/docs/source/resources/ErrorHandling.rst b/docs/source/resources/ErrorHandling.rst index 1f08c165..c6459a70 100644 --- a/docs/source/resources/ErrorHandling.rst +++ b/docs/source/resources/ErrorHandling.rst @@ -4,18 +4,18 @@ Error Handling 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 categories -(which are in turn children of the :obj:`pyrogram.Error` superclass) +(which are in turn children of the :obj:`RPCError ` 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 ` +- :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 ` As stated above, there are really many (too many) errors, and in case Pyrogram does not know anything yet about a -specific one, it raises a special :obj:`520 Unknown Error ` exception and logs it +specific one, it raises a special :obj:`520 Unknown Error ` exception and logs it in the ``unknown_errors.txt`` file. Users are invited to report these unknown errors; in later versions of Pyrogram some kind of automatic error reporting module might be implemented. @@ -24,7 +24,7 @@ Examples .. code-block:: python - from pyrogram.api.errors import ( + from pyrogram.errors import ( BadRequest, Flood, InternalServerError, SeeOther, Unauthorized, UnknownError ) @@ -45,13 +45,13 @@ Examples pass Exception objects may also contain some informative values. -E.g.: :obj:`FloodWait ` holds the amount of seconds you have to wait +E.g.: :obj:`FloodWait ` holds the amount of seconds you have to wait before you can try again. The value is always stored in the ``x`` field of the returned exception object: .. code-block:: python import time - from pyrogram.api.errors import FloodWait + from pyrogram.errors import FloodWait try: ... diff --git a/pyrogram/client/types/messages_and_media/poll_option.py b/pyrogram/client/types/messages_and_media/poll_option.py index a2be866e..c45c1db2 100644 --- a/pyrogram/client/types/messages_and_media/poll_option.py +++ b/pyrogram/client/types/messages_and_media/poll_option.py @@ -29,6 +29,7 @@ class PollOption(PyrogramType): voters (``int``): The number of users who voted this option. + It will be 0 until you vote for the poll. data (``bytes``): Unique data that identifies this option among all the other options in a poll.