aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorRapptz <[email protected]>2015-09-05 00:46:18 -0400
committerRapptz <[email protected]>2015-09-05 00:46:18 -0400
commit4aecd5f7b5b7e133dd2ab41365b5b7b72baaf9b3 (patch)
tree34f15877a0916ce61b75cfac9cf47ea7e165d26c /docs
parentRemove owner_id from Server and use owner instead. (diff)
downloaddiscord.py-4aecd5f7b5b7e133dd2ab41365b5b7b72baaf9b3.tar.xz
discord.py-4aecd5f7b5b7e133dd2ab41365b5b7b72baaf9b3.zip
Add on_error event for doing something about uncaught exceptions.
Diffstat (limited to 'docs')
-rw-r--r--docs/api.rst13
1 files changed, 13 insertions, 0 deletions
diff --git a/docs/api.rst b/docs/api.rst
index 945f34e6..0081f29e 100644
--- a/docs/api.rst
+++ b/docs/api.rst
@@ -30,6 +30,19 @@ All events are 'sandboxed', in that if an exception is thrown while the event is
Called when the client disconnects for whatever reason. Be it error or manually.
+.. function:: on_error(event, type, value, traceback)
+
+ Usually when an event throws an uncaught exception, it is swallowed. If you want to handle
+ the uncaught exceptions for whatever reason, this event is called. If an exception is thrown
+ on this event then it propagates (i.e. it is not swallowed silently).
+
+ The parameters for this event are retrieved through the use of ``sys.exc_info()``.
+
+ :param event: The event name that had the uncaught exception.
+ :param type: The type of exception that was swallowed.
+ :param value: The actual exception that was swallowed.
+ :param traceback: The traceback object representing the traceback of the exception swallowed.
+
.. function:: on_message(message)
Called when a message is created and sent to a server.