aboutsummaryrefslogtreecommitdiff
path: root/docs/api.rst
diff options
context:
space:
mode:
authorHornwitser <[email protected]>2015-10-22 21:23:36 +0200
committerHornwitser <[email protected]>2015-10-22 22:07:50 +0200
commit320cd39b6ac2bfd63a2498ee481c7e0c8ba98b8e (patch)
tree1b86757f2bad14cf9d705b22ea71d27b79ad7fa9 /docs/api.rst
parentAdd instructions for installing development version. (diff)
downloaddiscord.py-320cd39b6ac2bfd63a2498ee481c7e0c8ba98b8e.tar.xz
discord.py-320cd39b6ac2bfd63a2498ee481c7e0c8ba98b8e.zip
Print to stderr in on_error
Apparently the clever hack for logging in on_error was not so clever after all. If logging isn't configured, by the logging modules definition of not configured, which is root logger not having an Handlers attached, it will call logging.basicConfig(). Which messes up setups that define handlers for other loggers than the root logger. Going directly to the root logger rather than using the broken convenience methods for logger is not an option either, as logger before Python 3.2 does not have lastResort on the root logger, and prints an error when invoked without any handlers. Resolve by printing tracebacks to stderr by default in on_error.
Diffstat (limited to 'docs/api.rst')
-rw-r--r--docs/api.rst16
1 files changed, 5 insertions, 11 deletions
diff --git a/docs/api.rst b/docs/api.rst
index 0a4fcec8..eb59ca27 100644
--- a/docs/api.rst
+++ b/docs/api.rst
@@ -39,7 +39,7 @@ overriding the specific events. For example: ::
If an event handler raises an exception, :func:`on_error` will be called
-to handle it, which defaults to log a traceback and ignore the exception.
+to handle it, which defaults to print a traceback and ignore the exception.
.. versionadded:: 0.7.0
Subclassing to listen to events.
@@ -53,16 +53,10 @@ to handle it, which defaults to log a traceback and ignore the exception.
.. function:: on_error(event, \*args, \*\*kwargs)
Usually when an event raises an uncaught exception, a traceback is
- logged and the exception is ignored. If you want to change this
- behaviour and handle the exception for whatever reason yourself,
- this event can be overridden. Which, when done, will supress the
- default logging done.
-
- .. note::
-
- The default ``on_error`` handler logs exception to the root logger
- instead of a logger under the discord namespace. This is to ensure
- that exceptions are output somewhere if logging is not configured.
+ printed to stderr and the exception is ignored. If you want to
+ change this behaviour and handle the exception for whatever reason
+ yourself, this event can be overridden. Which, when done, will
+ supress the default action of printing the traceback.
The information of the exception rasied and the exception itself can
be retreived with a standard call to ``sys.exc_info()``.