aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2019-04-07 22:32:30 -0400
committerRapptz <[email protected]>2019-04-07 22:33:38 -0400
commit72b6152e96b4981e7ca9371a62c089a1bd867bdf (patch)
treed1a070ec140596f546486710d4e0dea17d3a1582
parent[commands] Raise TypeError instead of ClientException in some places (diff)
downloaddiscord.py-72b6152e96b4981e7ca9371a62c089a1bd867bdf.tar.xz
discord.py-72b6152e96b4981e7ca9371a62c089a1bd867bdf.zip
Client.event raises TypeError instead of ClientException.
-rw-r--r--discord/client.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/discord/client.py b/discord/client.py
index 2608fa6e..2817ecc0 100644
--- a/discord/client.py
+++ b/discord/client.py
@@ -754,7 +754,7 @@ class Client:
You can find more info about the events on the :ref:`documentation below <discord-api-events>`.
- The events must be a |corourl|_, if not, :exc:`ClientException` is raised.
+ The events must be a |corourl|_, if not, :exc:`TypeError` is raised.
Example
---------
@@ -764,10 +764,15 @@ class Client:
@client.event
async def on_ready():
print('Ready!')
+
+ Raises
+ --------
+ TypeError
+ The coroutine passed is not actually a coroutine.
"""
if not asyncio.iscoroutinefunction(coro):
- raise ClientException('event registered must be a coroutine function')
+ raise TypeError('event registered must be a coroutine function')
setattr(self, coro.__name__, coro)
log.debug('%s has successfully been registered as an event', coro.__name__)