aboutsummaryrefslogtreecommitdiff
path: root/discord
diff options
context:
space:
mode:
authorRapptz <[email protected]>2015-10-27 18:45:45 -0400
committerRapptz <[email protected]>2015-10-27 19:02:12 -0400
commitd14bffcd969c63a7a42858e3ed84409b4948f665 (patch)
treed53ca2ad54f26615b0272f48287eac65f457dd2a /discord
parentAll exceptions now derive from DiscordException. (diff)
downloaddiscord.py-d14bffcd969c63a7a42858e3ed84409b4948f665.tar.xz
discord.py-d14bffcd969c63a7a42858e3ed84409b4948f665.zip
Rename InvaldiDestination to a generic ClientException.
Diffstat (limited to 'discord')
-rw-r--r--discord/client.py4
-rw-r--r--discord/errors.py8
2 files changed, 8 insertions, 4 deletions
diff --git a/discord/client.py b/discord/client.py
index 2497e0f8..f088bc40 100644
--- a/discord/client.py
+++ b/discord/client.py
@@ -509,7 +509,7 @@ class Client(object):
elif isinstance(destination, Object):
return destination.id
else:
- raise InvalidDestination('Destination must be Channel, PrivateChannel, User, or str')
+ raise ClientException('Destination must be Channel, PrivateChannel, User, or Object')
def on_error(self, event_method, *args, **kwargs):
print('Ignoring exception in {}'.format(event_method), file=sys.stderr)
@@ -613,6 +613,8 @@ class Client(object):
``mentions`` is ``True`` then all the users mentioned in the content are mentioned, otherwise
no one is mentioned. Note that to mention someone in the content, you should use :meth:`User.mention`.
+ If the destination parameter is invalid, then this function raises :class:`ClientException`.
+
:param destination: The location to send the message.
:param content: The content of the message to send.
:param mentions: A list of :class:`User` to mention in the message or a boolean. Ignored for private messages.
diff --git a/discord/errors.py b/discord/errors.py
index e50e0386..ed50f8da 100644
--- a/discord/errors.py
+++ b/discord/errors.py
@@ -30,9 +30,11 @@ class DiscordException(Exception):
Ideally speaking, this could be caught to handle any exceptions thrown from this library.
"""
-class InvalidDestination(DiscordException):
- """Thrown when the destination from :meth:`Client.send_message` is invalid."""
- pass
+class ClientException(DiscordException):
+ """Exception that's thrown when an operation in the :class:`Client` fails.
+
+ These are usually for exceptions that happened due to user input.
+ """
class GatewayNotFound(DiscordException):
"""Thrown when the gateway hub for the :class:`Client` websocket is not found."""