aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2017-01-11 19:53:29 -0500
committerRapptz <[email protected]>2017-01-11 19:53:48 -0500
commit06ca5184596d187b1737484b265d847b8efb3dc1 (patch)
treec6f546a733c0e95ca7e17206946f7c05131ec87b
parentAllow HistoryIterator to be flattened into a list. (diff)
downloaddiscord.py-06ca5184596d187b1737484b265d847b8efb3dc1.tar.xz
discord.py-06ca5184596d187b1737484b265d847b8efb3dc1.zip
Rename NoMoreMessages to NoMoreItems.
-rw-r--r--discord/abc.py6
-rw-r--r--discord/errors.py7
-rw-r--r--discord/iterators.py6
-rw-r--r--docs/api.rst2
4 files changed, 12 insertions, 9 deletions
diff --git a/discord/abc.py b/discord/abc.py
index 0cae7b49..4cd288d1 100644
--- a/discord/abc.py
+++ b/discord/abc.py
@@ -33,7 +33,7 @@ from collections import namedtuple
from .iterators import HistoryIterator
from .context_managers import Typing
-from .errors import ClientException, NoMoreMessages, InvalidArgument
+from .errors import ClientException, NoMoreItems, InvalidArgument
from .permissions import PermissionOverwrite, Permissions
from .role import Role
from . import utils, compat
@@ -740,7 +740,7 @@ class Messageable(metaclass=abc.ABCMeta):
while True:
try:
message = yield from iterator.get()
- except discord.NoMoreMessages:
+ except discord.NoMoreItems:
break
else:
if message.author == client.user:
@@ -813,7 +813,7 @@ class Messageable(metaclass=abc.ABCMeta):
while True:
try:
msg = yield from iterator.get()
- except NoMoreMessages:
+ except NoMoreItems:
# no more messages to poll
if count >= 2:
# more than 2 messages -> bulk delete
diff --git a/discord/errors.py b/discord/errors.py
index 46751b62..795c0bf6 100644
--- a/discord/errors.py
+++ b/discord/errors.py
@@ -38,9 +38,10 @@ class ClientException(DiscordException):
"""
pass
-class NoMoreMessages(DiscordException):
- """Exception that is thrown when a ``history`` operation has no more
- messages. This is only exposed for Python 3.4 only.
+class NoMoreItems(DiscordException):
+ """Exception that is thrown when an async iteration operation has no more
+ items. This is mainly exposed for Python 3.4 support where `StopAsyncIteration`
+ is not provided.
"""
pass
diff --git a/discord/iterators.py b/discord/iterators.py
index 8e535a7e..e1de1ddb 100644
--- a/discord/iterators.py
+++ b/discord/iterators.py
@@ -29,7 +29,7 @@ import asyncio
import aiohttp
import datetime
-from .errors import NoMoreMessages
+from .errors import NoMoreItems
from .utils import time_snowflake
from .object import Object
@@ -132,7 +132,7 @@ class HistoryIterator:
try:
return self.messages.get_nowait()
except asyncio.QueueEmpty:
- raise NoMoreMessages()
+ raise NoMoreItems()
@asyncio.coroutine
def flatten(self):
@@ -217,7 +217,7 @@ class HistoryIterator:
try:
msg = yield from self.get()
return msg
- except NoMoreMessages:
+ except NoMoreItems:
# if we're still empty at this point...
# we didn't get any new messages so stop looping
raise StopAsyncIteration()
diff --git a/docs/api.rst b/docs/api.rst
index c3f6aabc..1855e5ac 100644
--- a/docs/api.rst
+++ b/docs/api.rst
@@ -782,6 +782,8 @@ The following exceptions are thrown by the library.
.. autoexception:: LoginFailure
+.. autoexception:: NoMoreItems
+
.. autoexception:: HTTPException
:members: