Skip to content

feat!: raise BuildError instead of exiting from a failed build - #483

Merged
has2k1 merged 3 commits into
mainfrom
refactor/build-error
Oct 30, 2026
Merged

has2k1 merged 3 commits into
mainfrom
refactor/build-error

Conversation

@has2k1

@has2k1 has2k1 commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator

GreatDocs.build() now raises a new public BuildError when a build fails, instead of ending the process. It used to call sys.exit(1) when the API reference could not be generated, when every version of a multi-version site failed, or when Quarto failed to render, and a configured reference name missing from the installed package raised SystemExit. Code that calls great-docs as a library could not catch these as ordinary exceptions, and a failed build over the MCP server could stop the server.

BuildError derives from RuntimeError, as do the existing errors for a missing or outdated Quarto, which now derive from it. Each failure is still reported once with the same wording. great-docs build and great-docs preview still exit with status 1, great-docs api-snapshot prints the missing-name error instead of a traceback, and the MCP build tool returns an error with the build log. great-docs freeze now stops with status 1 when preparing the build fails, where it used to render pages from a half-prepared build directory.

Export `BuildError`, a `RuntimeError` subclass, for documentation builds that
leave no usable site. Include it in the API reference. No build path raises
it yet.
Raise `BuildError` instead of exiting when API reference generation fails,
every version of a multi-version site fails, or Quarto fails to render. Also
raise it when a configured reference name is missing from an installed
package, both during builds and when querying documented symbols.

Derive missing and outdated Quarto errors from `BuildError`, preserving
their `RuntimeError` base. Library callers can catch build failures as
ordinary exceptions, and failed builds no longer stop the MCP server.

Report each failure once, with unchanged wording, before raising it: in the
build log, or on standard error for missing Quarto or reference names.

- Exit `great-docs build` and `great-docs preview` with status 1 without
  printing the failure again.
- Print the missing-name error and exit `great-docs api-snapshot` with
  status 1 instead of showing a traceback.
- Return an MCP build error result with the message and build log.
- Leave `great-docs freeze` unchanged: it still carries on when
  preparation fails.
When build preparation fails, exit `great-docs freeze` with status 1 after
the failure has been reported. Render no pages.

Previously the command ignored a failed preparation, for example a
configured reference name missing from the installed package, and went on
to render pages from a half-prepared build directory.
@github-actions

Copy link
Copy Markdown

📚 Preview this PR's docs locally

Fetch the just-built site and open it in your browser:

# this exact build
great-docs preview --run 41037553527

# or always the latest build for this PR
great-docs preview --pr 483
Auth & tips
  • Requires great-docs: pip install great-docs (or run via pipx/uvx).
  • Auth: run gh auth login then add --use-gh, or set GITHUB_TOKEN (needs Actions: read).
  • Jump to a page: add --path reference/index.html.
  • Latest vs exact: --pr <n> grabs the newest build; --run <id> pins this one.
  • Re-download: --refresh ignores the local cache.

@has2k1
has2k1 merged commit c4478f4 into main Oct 30, 2026
9 checks passed
@has2k1
has2k1 deleted the refactor/build-error branch October 30, 2026 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant