Skip to content

Preserve the suppressed context of an original error - #320

Open
cheapsteak wants to merge 1 commit into
graphql-python:mainfrom
cheapsteak:preserve-suppressed-context
Open

cheapsteak wants to merge 1 commit into
graphql-python:mainfrom
cheapsteak:preserve-suppressed-context

Conversation

@cheapsteak

Copy link
Copy Markdown

Fixes #319

GraphQLError.__init__ copied original_error.__context__ but not original_error.__suppress_context__. So an error raised from None got its hidden context back when it was wrapped, for example by located_error for every resolver error. This change copies the flag together with the context.

Tests

  • New test passes_the_suppressed_context_of_an_original_error in tests/error/test_graphql_error.py. It fails without the change and passes with it.
  • pytest tests: 3822 passed, 18 skipped.
  • ruff check, ruff format --check and mypy pass on the changed files.

Disclosure: this pull request was written by Claude (Anthropic's AI assistant, via Claude Code) on behalf of @cheapsteak, who reviewed it and takes responsibility for the change.

GraphQLError copied the context of an original error but not its
__suppress_context__ flag, so an error raised "from None" got its
hidden context back when it was wrapped, e.g. by located_error.

Fixes graphql-python#319

Claude-Session: https://claude.ai/code/session_01R8Hmf6XiRffNRSfDMNSFjh
@cheapsteak
cheapsteak requested a review from Cito as a code owner November 12, 2026 15:54
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.

GraphQLError drops __suppress_context__ from original_error, so raise ... from None is undone

1 participant