diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-07-04 19:32:54 +0300 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-07-04 19:32:54 +0300 |
commit | ec3754bd94eaa3aa3c5410ee6ab100bb27bfb798 (patch) | |
tree | d0446a967a4f8cbc3208d48d6bf3d9b7c90ca25e /sphinx/config.py | |
parent | b268963709dc9256cf711d4cc054a86e70226702 (diff) | |
parent | 9fd9edebb47a3a5eda8c6065b12b71cdb0985a73 (diff) |
Merge branch '3.x'
Diffstat (limited to 'sphinx/config.py')
-rw-r--r-- | sphinx/config.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sphinx/config.py b/sphinx/config.py index 8206653ab..a6d070e3f 100644 --- a/sphinx/config.py +++ b/sphinx/config.py @@ -191,9 +191,9 @@ class Config: elif isinstance(defvalue, int): try: return int(value) - except ValueError: + except ValueError as exc: raise ValueError(__('invalid number %r for config value %r, ignoring') % - (value, name)) + (value, name)) from exc elif hasattr(defvalue, '__call__'): return value elif defvalue is not None and not isinstance(defvalue, str): @@ -316,17 +316,17 @@ def eval_config_file(filename: str, tags: Tags) -> Dict[str, Any]: exec(code, namespace) except SyntaxError as err: msg = __("There is a syntax error in your configuration file: %s\n") - raise ConfigError(msg % err) - except SystemExit: + raise ConfigError(msg % err) from err + except SystemExit as exc: msg = __("The configuration file (or one of the modules it imports) " "called sys.exit()") - raise ConfigError(msg) + raise ConfigError(msg) from exc except ConfigError: # pass through ConfigError from conf.py as is. It will be shown in console. raise - except Exception: + except Exception as exc: msg = __("There is a programmable error in your configuration file:\n\n%s") - raise ConfigError(msg % traceback.format_exc()) + raise ConfigError(msg % traceback.format_exc()) from exc return namespace |