mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Show traceback if conf.py raises an exception (refs: #4369)
This commit is contained in:
parent
4bc4b35352
commit
6fa344c951
1
CHANGES
1
CHANGES
@ -17,6 +17,7 @@ Features added
|
|||||||
* ``VerbatimHighlightColor`` is a new
|
* ``VerbatimHighlightColor`` is a new
|
||||||
:ref:`LaTeX 'sphinxsetup' <latexsphinxsetup>` key (refs: #4285)
|
:ref:`LaTeX 'sphinxsetup' <latexsphinxsetup>` key (refs: #4285)
|
||||||
* Easier customizability of LaTeX macros involved in rendering of code-blocks
|
* Easier customizability of LaTeX macros involved in rendering of code-blocks
|
||||||
|
* Show traceback if conf.py raises an exception (refs: #4369)
|
||||||
|
|
||||||
Bugs fixed
|
Bugs fixed
|
||||||
----------
|
----------
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
import traceback
|
||||||
from os import path, getenv
|
from os import path, getenv
|
||||||
|
|
||||||
from six import PY2, PY3, iteritems, string_types, binary_type, text_type, integer_types
|
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"
|
CONFIG_SYNTAX_ERROR = "There is a syntax error in your configuration file: %s"
|
||||||
if PY3:
|
if PY3:
|
||||||
CONFIG_SYNTAX_ERROR += "\nDid you change the syntax from 2.x to 3.x?"
|
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) " \
|
CONFIG_EXIT_ERROR = "The configuration file (or one of the modules it imports) " \
|
||||||
"called sys.exit()"
|
"called sys.exit()"
|
||||||
CONFIG_ENUM_WARNING = "The config value `{name}` has to be a one of {candidates}, " \
|
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)
|
raise ConfigError(CONFIG_SYNTAX_ERROR % err)
|
||||||
except SystemExit:
|
except SystemExit:
|
||||||
raise ConfigError(CONFIG_EXIT_ERROR)
|
raise ConfigError(CONFIG_EXIT_ERROR)
|
||||||
|
except Exception:
|
||||||
|
raise ConfigError(CONFIG_ERROR % traceback.format_exc())
|
||||||
|
|
||||||
self._raw_config = config
|
self._raw_config = config
|
||||||
# these two must be preinitialized because extensions can add their
|
# these two must be preinitialized because extensions can add their
|
||||||
|
Loading…
Reference in New Issue
Block a user