[engine] Report current module when error occurs

Keep track of the latest updated module in the engine part, so that the
module causing an exception can be reported correctly.

fixes #110
This commit is contained in:
Tobias Witek 2017-06-10 14:08:49 +02:00
parent dc06611fb1
commit 7d13268f66
2 changed files with 7 additions and 1 deletions

View file

@ -42,6 +42,7 @@ def main():
inp.stop()
sys.exit(0)
except BaseException as e:
module = engine.current_module()
logging.exception(e)
if output.started():
output.flush()
@ -52,7 +53,7 @@ def main():
while True:
output.begin()
error = bumblebee.modules.error.Module(engine, config)
error.set("exception occurred: {}".format(e))
error.set("exception occurred: {} in {}".format(e, module))
widget = error.widgets()[0]
widget.link_module(error)
output.draw(widget, error)