diff --git a/electrum/daemon.py b/electrum/daemon.py index d0bdee898..c60adbef3 100644 --- a/electrum/daemon.py +++ b/electrum/daemon.py @@ -513,11 +513,13 @@ class Daemon(Logger): if gui_name in ['lite', 'classic']: gui_name = 'qt' self.logger.info(f'launching GUI: {gui_name}') - gui = __import__('electrum.gui.' + gui_name, fromlist=['electrum']) - self.gui_object = gui.ElectrumGui(config, self, plugins) try: + gui = __import__('electrum.gui.' + gui_name, fromlist=['electrum']) + self.gui_object = gui.ElectrumGui(config, self, plugins) self.gui_object.main() except BaseException as e: - self.logger.exception('') + self.logger.error(f'GUI raised exception: {repr(e)}. shutting down.') + raise + finally: # app will exit now - self.on_stop() + self.on_stop() diff --git a/run_electrum b/run_electrum index e7f6a29b9..83fb8707d 100755 --- a/run_electrum +++ b/run_electrum @@ -370,8 +370,13 @@ if __name__ == '__main__': if fd is not None: plugins = init_plugins(config, config.get('gui', 'qt')) d = daemon.Daemon(config, fd) - d.run_gui(config, plugins) - sys_exit(0) + try: + d.run_gui(config, plugins) + except BaseException as e: + _logger.exception('daemon.run_gui errored') + sys_exit(1) + else: + sys_exit(0) else: result = daemon.request(config, 'gui', (config_options,))