Repository navigation
馃悰 Warn on needservice naming an unregistered service instead of crashing - #2103
Closed
havinash-007 wants to merge 2 commits into
Closed
havinash-007 wants to merge 2 commits into
havinash-007 wants to merge 2 commits into
Conversation
NeedsServiceException derived from BaseException and was not caught in NeedserviceDirective.run, ending the build with a raw traceback. Report a needs.directive warning and return no nodes, and derive the exception from Exception. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Member
|
Thanks for the quick fix. #2101 is now fixed through #2113, so I'm closing this one in its favour. #2113 fixes it together with #2067: the registration check there means a service whose |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2101
What
A
needservicenaming an unregistered service ended the build with a raw traceback:ServiceManager.getraisesNeedsServiceException, which derived fromBaseExceptionand was not caught inNeedserviceDirective.run, so it also bypassed Sphinx's ownexcept Exceptionhandling.NeedserviceDirective.runnow catches it and reports a locatedneeds.directivewarning (same text: the service name and the registered ones), then returns no nodes so the build continues (-Wfails it like any other warning).NeedsServiceExceptionnow derives fromException(as suggested in the issue; nothing in the repo relies on it bypassingexcept Exception).tests/test_service_unknown.py(fails before with the exception, passes after) and a changelog entry.Checks
test_service_unknown.py; fails before the change, passes after)docs/changelog.rstuv run poe lint(all prek hooks, incl. ruff and ty) passesuv run pytest packages/sphinx-needs/tests -k servicepassesAI assistance
This change was prepared with Claude Code (AI agent); I reviewed the diff and test results.
馃 Generated with Claude Code