Skip to content

fix: NamedGraphError reports the offending graph IRI#82

Open
jeswr wants to merge 1 commit into
rdfjs:mainfrom
jeswr:fix/named-graph-error-message
Open

fix: NamedGraphError reports the offending graph IRI#82
jeswr wants to merge 1 commit into
rdfjs:mainfrom
jeswr:fix/named-graph-error-message

Conversation

@jeswr

@jeswr jeswr commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

What this does

NamedGraphError's message interpolated quad.value, which is always the empty string for an RDF/JS Quad, so the error read:

Graph must be default (empty) but was

and never told you which graph caused the failure. This changes the interpolation to quad.graph.value so the message reports the offending graph IRI, and adds a regression test in test/unit/named_graph.test.ts asserting the thrown message contains that IRI.

No API change: the constructor signature and error hierarchy are untouched.

Related issues / PRs

  • Addresses the defensive/robust-code theme of Improvement: Robust code (defensive) #6 (errors should carry actionable diagnostics).
  • Supersedes exactly one slice of the omnibus draft Omnibus #73: the NamedGraphError message fix (quad.value -> quad.graph.value). The accompanying Quad -> BaseQuad signature change in Omnibus #73 belongs to the scoped-dataset refactor and is deliberately not included here.

Review timing: This draft was prepared with Claude; I (@jeswr) will personally review it before it progresses. I'm currently batching a lot of work in flight, so expect active review Wednesday-Friday (8-10 July).

The error message interpolated quad.value, which is always the empty
string for an RDF/JS Quad, so the message never named the graph that
caused the failure. Use quad.graph.value instead, and add a regression
test asserting the thrown message contains the offending graph IRI.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@jeswr jeswr mentioned this pull request Jul 6, 2026

@jeswr jeswr left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jeswr
jeswr marked this pull request as ready for review July 10, 2026 01:53
@jeswr
jeswr requested a review from matthieubosquet as a code owner July 10, 2026 01:53
Copilot AI review requested due to automatic review settings July 10, 2026 01:53
@jeswr
jeswr requested a review from langsamu as a code owner July 10, 2026 01:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

2 participants