diff options
| author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2018-01-05 14:18:43 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-01-05 14:18:43 +0900 |
| commit | 4277eb13315d5649401190df86874b3832ddfa3e (patch) | |
| tree | 16debae3a37d344cd37f644304809baac7905de8 | |
| parent | 369d66e41e255e2341299e2794110ef1b6910721 (diff) | |
| parent | 6fa344c951a8c9c67c4fd7492a758f8e70ee3c4f (diff) | |
| download | sphinx-git-4277eb13315d5649401190df86874b3832ddfa3e.tar.gz | |
Merge pull request #4373 from tk0miya/4369_show_traceback_on_exception_from_conf.py
Show traceback if conf.py raises an exception (refs: #4369)
| -rw-r--r-- | CHANGES | 1 | ||||
| -rw-r--r-- | sphinx/config.py | 4 |
2 files changed, 5 insertions, 0 deletions
@@ -17,6 +17,7 @@ Features added * ``VerbatimHighlightColor`` is a new :ref:`LaTeX 'sphinxsetup' <latexsphinxsetup>` key (refs: #4285) * Easier customizability of LaTeX macros involved in rendering of code-blocks +* Show traceback if conf.py raises an exception (refs: #4369) Bugs fixed ---------- diff --git a/sphinx/config.py b/sphinx/config.py index d3468b0a5..50f7c018c 100644 --- a/sphinx/config.py +++ b/sphinx/config.py @@ -10,6 +10,7 @@ """ import re +import traceback from os import path, getenv from six import PY2, PY3, iteritems, string_types, binary_type, text_type, integer_types @@ -35,6 +36,7 @@ copyright_year_re = re.compile(r'^((\d{4}-)?)(\d{4})(?=[ ,])') CONFIG_SYNTAX_ERROR = "There is a syntax error in your configuration file: %s" if PY3: CONFIG_SYNTAX_ERROR += "\nDid you change the syntax from 2.x to 3.x?" +CONFIG_ERROR = "There is a programable error in your configuration file:\n\n%s" CONFIG_EXIT_ERROR = "The configuration file (or one of the modules it imports) " \ "called sys.exit()" CONFIG_ENUM_WARNING = "The config value `{name}` has to be a one of {candidates}, " \ @@ -152,6 +154,8 @@ class Config(object): raise ConfigError(CONFIG_SYNTAX_ERROR % err) except SystemExit: raise ConfigError(CONFIG_EXIT_ERROR) + except Exception: + raise ConfigError(CONFIG_ERROR % traceback.format_exc()) self._raw_config = config # these two must be preinitialized because extensions can add their |
