Improve changelog error handling a bit when called from sphinx

develop
lethosor 2020-07-13 20:14:11 -04:00
parent ced8f4a551
commit 89283026ae
1 changed files with 9 additions and 2 deletions

@ -4,6 +4,8 @@ import itertools
import os import os
import sys import sys
from sphinx.errors import ExtensionError, SphinxError, SphinxWarning
from dfhack.util import DFHACK_ROOT, DOCS_ROOT from dfhack.util import DFHACK_ROOT, DOCS_ROOT
CHANGELOG_PATHS = ( CHANGELOG_PATHS = (
@ -214,7 +216,7 @@ def generate_changelog(all=False):
# scan for unrecognized sections # scan for unrecognized sections
for entry in entries: for entry in entries:
if entry.section not in CHANGELOG_SECTIONS: if entry.section not in CHANGELOG_SECTIONS:
raise RuntimeWarning('Unknown section: ' + entry.section) raise SphinxWarning('Unknown section: ' + entry.section)
# ordered versions # ordered versions
versions = ['future'] versions = ['future']
@ -287,7 +289,12 @@ def cli_entrypoint():
def sphinx_entrypoint(app, config): def sphinx_entrypoint(app, config):
generate_changelog() try:
generate_changelog()
except SphinxError:
raise
except Exception as e:
raise ExtensionError(str(e), e)
def setup(app): def setup(app):