diff options
Diffstat (limited to 'alot/settings/manager.py')
-rw-r--r-- | alot/settings/manager.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/alot/settings/manager.py b/alot/settings/manager.py index e5dcc4b3..badda2af 100644 --- a/alot/settings/manager.py +++ b/alot/settings/manager.py @@ -135,12 +135,17 @@ class SettingsManager: self._config.walk(self._expand_config_values) hooks_path = os.path.expanduser(self._config.get('hooksfile')) - try: - spec = importlib.util.spec_from_file_location('hooks', hooks_path) - self.hooks = importlib.util.module_from_spec(spec) - spec.loader.exec_module(self.hooks) - except: - logging.exception('unable to load hooks file:%s', hooks_path) + if os.path.isfile(hooks_path): + try: + spec = importlib.util.spec_from_file_location('hooks', hooks_path) + self.hooks = importlib.util.module_from_spec(spec) + spec.loader.exec_module(self.hooks) + except Exception as e: + self.hooks = None + raise ConfigError('Error loading hooks: %s' % str(e)) from e + else: + logging.info('Hooks file does not exist') + if 'bindings' in newconfig: self._update_bindings(newconfig['bindings']) |