]>
jfr.im git - erebus.git/blob - modules/exception_hook.py
1 # Erebus IRC bot - Author: Erebus Team
2 # vim: fileencoding=utf-8
3 # This file is released into the public domain; see http://unlicense.org/
7 'author': 'Erebus Team',
8 'license': 'public domain',
9 'compatible': [0], # compatible module API versions
10 'depends': [], # other modules required to work properly?
11 'softdeps': [], # modules which are preferred but not required
16 lib
= modlib
.modlib(__name__
)
17 modstart
= lib
.modstart
23 @lib.hookexception(Exception)
24 def got_exception(bot
, exc
, source
, *args
, **kwargs
):
25 dest
= lib
.parent
.cfg
.get('exception_hook', 'destination')
27 bot
.msg(dest
, '%s exception: %r %r' % (source
, args
, kwargs
))
28 for line
in traceback
.format_exc(limit
=lib
.parent
.cfg
.getint('exception_hook', 'limit', 5)).split("\n"):
29 bot
.msg(dest
, (' '*4) + line
)