diff --git a/bumblebee-status b/bumblebee-status index 582f314..1f94410 100755 --- a/bumblebee-status +++ b/bumblebee-status @@ -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) diff --git a/bumblebee/engine.py b/bumblebee/engine.py index c0ea9cc..2142d50 100644 --- a/bumblebee/engine.py +++ b/bumblebee/engine.py @@ -81,6 +81,7 @@ class Engine(object): self.input = inp self._aliases = self._read_aliases() self.load_modules(config.modules()) + self._current_module = None self.input.register_callback(None, bumblebee.input.WHEEL_UP, "i3-msg workspace prev_on_output") @@ -145,12 +146,16 @@ class Engine(object): """Stop the event loop""" self._running = False + def current_module(self): + return self._current_module.__module__ + def run(self): """Start the event loop""" self._output.start() while self.running(): self._output.begin() for module in self._modules: + self._current_module = module module.update(module.widgets()) for widget in module.widgets(): widget.link_module(module)