🐛 `SphinxNeedLayoutException` and `NeedumlException` subclass `BaseException` and escape every handler

Open
#2,254 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
Half a day
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
devtools

Research direction

Start with the two class definitions at packages/sphinx-needs/src/sphinx_needs/layout.py:1325 and packages/sphinx-needs/src/sphinx_needs/directives/needuml.py:760-765, then find where the layout and uml/flow code raises them. Change the base class to Exception or SphinxError, and make the directive report a warning or Sphinx error instead of letting the exception escape. Done when a layout with a {{nosuch}} placeholder and uml("NOPE") produce a normal Sphinx error message rather than a traceback, and the existing tests still pass.

Written by the indexing model from the issue text.

Description

bug pkg: sphinx-needs

Two exception classes subclass BaseException rather than Exception:

  • SphinxNeedLayoutException (packages/sphinx-needs/src/sphinx_needs/layout.py:1325)
  • NeedumlException (packages/sphinx-needs/src/sphinx_needs/directives/needuml.py:760-765)

They therefore bypass every except Exception in sphinx-needs and Sphinx's own top-level handler. Measured at master 3210ac5c (2026-10-14): a layout with a {{nosuch}} placeholder exits with code 1 and a raw traceback instead of a Sphinx error message; uml("NOPE") / flow("NOPE") / need() in a needuml take the same path by reading.

Fix: subclass Exception (or SphinxError), and let the directive turn them into a warning or a normal Sphinx error.

Dominant language
Python
Stars
309
Forks
103
Avg merge
3h 37m
Merged PRs (30d)
170

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from useblocks/sphinx-needs

All issues in useblocks/sphinx-needs

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.