Skip to content

Commit

Permalink
Improve changelog error handling a bit when called from sphinx
Browse files Browse the repository at this point in the history
  • Loading branch information
lethosor committed Jul 14, 2020
1 parent ced8f4a commit 8928302
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions docs/sphinx_extensions/dfhack/changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import os
import sys

from sphinx.errors import ExtensionError, SphinxError, SphinxWarning

from dfhack.util import DFHACK_ROOT, DOCS_ROOT

CHANGELOG_PATHS = (
Expand Down Expand Up @@ -214,7 +216,7 @@ def generate_changelog(all=False):
# scan for unrecognized sections
for entry in entries:
if entry.section not in CHANGELOG_SECTIONS:
raise RuntimeWarning('Unknown section: ' + entry.section)
raise SphinxWarning('Unknown section: ' + entry.section)

# ordered versions
versions = ['future']
Expand Down Expand Up @@ -287,7 +289,12 @@ def cli_entrypoint():


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):
Expand Down

0 comments on commit 8928302

Please sign in to comment.