diff options
author | Ram Rachum <ram@rachum.com> | 2020-06-14 00:46:19 +0300 |
---|---|---|
committer | Ram Rachum <ram@rachum.com> | 2020-06-14 14:37:16 +0300 |
commit | 53c1dff91c0b7100e1ce1b51acbf0fffbc10cf9c (patch) | |
tree | 93bca0f98dfcf0f83f32987f898a7fbafe8f25dd /sphinx/theming.py | |
parent | 0fc97a0b56d31f2703ff42dfe946e8d11d667909 (diff) |
Fix exception causes all over the codebase
Diffstat (limited to 'sphinx/theming.py')
-rw-r--r-- | sphinx/theming.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/sphinx/theming.py b/sphinx/theming.py index 13a895393..087ee7f24 100644 --- a/sphinx/theming.py +++ b/sphinx/theming.py @@ -74,17 +74,17 @@ class Theme: try: inherit = self.config.get('theme', 'inherit') - except configparser.NoSectionError: - raise ThemeError(__('theme %r doesn\'t have "theme" setting') % name) - except configparser.NoOptionError: - raise ThemeError(__('theme %r doesn\'t have "inherit" setting') % name) + except configparser.NoSectionError as exc: + raise ThemeError(__('theme %r doesn\'t have "theme" setting') % name) from exc + except configparser.NoOptionError as exc: + raise ThemeError(__('theme %r doesn\'t have "inherit" setting') % name) from exc if inherit != 'none': try: self.base = factory.create(inherit) - except ThemeError: + except ThemeError as exc: raise ThemeError(__('no theme named %r found, inherited by %r') % - (inherit, name)) + (inherit, name)) from exc def get_theme_dirs(self) -> List[str]: """Return a list of theme directories, beginning with this theme's, @@ -101,13 +101,13 @@ class Theme: """ try: return self.config.get(section, name) - except (configparser.NoOptionError, configparser.NoSectionError): + except (configparser.NoOptionError, configparser.NoSectionError) as exc: if self.base: return self.base.get_config(section, name, default) if default is NODEFAULT: raise ThemeError(__('setting %s.%s occurs in none of the ' - 'searched theme configs') % (section, name)) + 'searched theme configs') % (section, name)) from exc else: return default |