diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-07-05 01:32:54 +0900 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-07-05 01:32:54 +0900 |
commit | ec3754bd94eaa3aa3c5410ee6ab100bb27bfb798 (patch) | |
tree | d0446a967a4f8cbc3208d48d6bf3d9b7c90ca25e /sphinx/theming.py | |
parent | b268963709dc9256cf711d4cc054a86e70226702 (diff) | |
parent | 9fd9edebb47a3a5eda8c6065b12b71cdb0985a73 (diff) | |
download | sphinx-git-ec3754bd94eaa3aa3c5410ee6ab100bb27bfb798.tar.gz |
Merge branch '3.x'
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 2636329a0..c05d87407 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 |