From 1771311d92e0dd1f338d91508b9a670c536dfff3 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Wed, 2 Oct 2024 23:24:42 +0100 Subject: [PATCH] Improve handling for errors in pre-build commands (#181) --- sphinx_autobuild/build.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sphinx_autobuild/build.py b/sphinx_autobuild/build.py index 9579148..f0d8126 100644 --- a/sphinx_autobuild/build.py +++ b/sphinx_autobuild/build.py @@ -5,6 +5,7 @@ import contextlib import subprocess import sys +import traceback from collections.abc import Sequence from pathlib import Path @@ -45,7 +46,14 @@ def __call__(self, *, changed_paths: Sequence[Path]): "Please fix the cause of the error above or press Ctrl+C to stop the " "server." ) - raise + print( + "The server will continue serving the build folder, but the contents " + "being served are no longer in sync with the documentation sources. " + "Please fix the cause of the error above or press Ctrl+C to stop the " + "server." + ) + traceback.print_exception(e) + return if sphinx.version_info[:3] >= (7, 2, 3): sphinx_build_args = ["-m", "sphinx", "build"] + self.sphinx_args