diff options
Diffstat (limited to 'sphinx/builders')
-rw-r--r-- | sphinx/builders/gettext.py | 2 | ||||
-rw-r--r-- | sphinx/builders/html/__init__.py | 4 | ||||
-rw-r--r-- | sphinx/builders/latex/theming.py | 8 |
3 files changed, 8 insertions, 6 deletions
diff --git a/sphinx/builders/gettext.py b/sphinx/builders/gettext.py index 65f112510..8e30762e9 100644 --- a/sphinx/builders/gettext.py +++ b/sphinx/builders/gettext.py @@ -278,7 +278,7 @@ class MessageCatalogBuilder(I18nBuilder): origin = MsgOrigin(template, line) self.catalogs['sphinx'].add(msg, origin) except Exception as exc: - raise ThemeError('%s: %r' % (template, exc)) + raise ThemeError('%s: %r' % (template, exc)) from exc def build(self, docnames: Iterable[str], summary: str = None, method: str = 'update') -> None: # NOQA self._extract_from_template() diff --git a/sphinx/builders/html/__init__.py b/sphinx/builders/html/__init__.py index 5340c93f9..99d7aa13b 100644 --- a/sphinx/builders/html/__init__.py +++ b/sphinx/builders/html/__init__.py @@ -140,7 +140,7 @@ class BuildInfo: build_info.tags_hash = lines[3].split()[1].strip() return build_info except Exception as exc: - raise ValueError(__('build info file is broken: %r') % exc) + raise ValueError(__('build info file is broken: %r') % exc) from exc def __init__(self, config: Config = None, tags: Tags = None, config_categories: List[str] = []) -> None: # NOQA self.config_hash = '' @@ -1015,7 +1015,7 @@ class StandaloneHTMLBuilder(Builder): return except Exception as exc: raise ThemeError(__("An error happened in rendering the page %s.\nReason: %r") % - (pagename, exc)) + (pagename, exc)) from exc if not outfilename: outfilename = self.get_outfilename(pagename) diff --git a/sphinx/builders/latex/theming.py b/sphinx/builders/latex/theming.py index da6a7fa04..130bded4a 100644 --- a/sphinx/builders/latex/theming.py +++ b/sphinx/builders/latex/theming.py @@ -87,10 +87,12 @@ class UserTheme(Theme): try: value = self.config.get('theme', key) setattr(self, key, value) - except configparser.NoSectionError: - raise ThemeError(__('%r doesn\'t have "theme" setting') % filename) + except configparser.NoSectionError as exc: + raise ThemeError(__('%r doesn\'t have "theme" setting') % + filename) from exc except configparser.NoOptionError as exc: - raise ThemeError(__('%r doesn\'t have "%s" setting') % (filename, exc.args[0])) + raise ThemeError(__('%r doesn\'t have "%s" setting') % + (filename, exc.args[0])) from exc for key in self.OPTIONAL_CONFIG_KEYS: try: |