Skip to content

feat: give the error page a way onward - #631

Merged
ashleycaselli merged 1 commit into
masterfrom
feat/616-error-page-way-onward
Aug 24, 2026
Merged

feat: give the error page a way onward#631
ashleycaselli merged 1 commit into
masterfrom
feat/616-error-page-way-onward

Conversation

@ashleycaselli

Copy link
Copy Markdown
Member

Closes #616.

ErrorPage said what went wrong and nothing else — no link home, no way back to what the user was doing, no hint of who could act on it. Compare NanopubNotFoundPage, which explains the situation, offers a retry and a link home, and answers with a fitting HTTP status.

The shape of the error, not just its details

A new ErrorPage.Kind, set through a kind page parameter next to the existing message, says whose problem it is. It decides what the page tells the user to do, whether it offers a way to report the problem, and the status it is answered with:

Kind What the page says Status
REQUEST The address is wrong; you — or whoever wrote the link — can correct it 400
NOT_FOUND There is no page at this address (which it spells out) 404
CONTENT The published nanopublication is at fault; only its author can put it right, by publishing a corrected version 422
MALFUNCTION This one is on Nanodash, and here is how to report it 500

configureResponse() answers with the matching status the way NanopubNotFoundPage does, so non-browser clients can tell these apart too. Without a kind, the page falls back to the status the servlet container settled on — that is how web.xml's /error/404 and /error/500 arrive — and to MALFUNCTION otherwise, since an error nobody foresaw usually is one.

A way onward

  • A link home on every error page.
  • A link back to where the user was, built from the Referer and accepted only for this instance's own pages — an off-site referrer is not where they were working — and never for an error page itself, which would only loop.
  • For the errors that are ours, a pre-filled issue on the tracker carrying what the user saw, the failing address, where they came from, and the Nanodash version, so a malfunction doesn't dead-end at a stack trace in the server log.

Callers say what they ran into

  • NanopubNotFoundPage.forwardFor() marks a malformed identifier as the asking user's to correct.
  • GrlcQuery classifies a failed load — the asking user's when the ID holds no artifact code at all, so nothing could have been fetched for it, and the query author's otherwise — and passes it through QueryLoadException.getKind() to QueryPage.
  • The "which only a corrected version of it can fix" sentence moves out of the SPARQL message and into the page, where it now covers every error of that kind rather than just that one.

Tests

11 tests in ErrorPageTest cover the per-kind wording and status, the report link's presence and contents, the back-link's accept and reject cases, and the container-status takeover. Kind assertions were added to GrlcQueryTest, QueryPageTest, and NanopubNotFoundPageTest. Full suite green: 1134 tests, 0 failures.

🤖 Generated with Claude Code

The error page said what went wrong and nothing else: no link home, no way
back to what the user was doing, and no hint of who could act on it.

An ErrorPage.Kind, set through a new "kind" page parameter next to the
existing message, now carries the shape of the response around those
details: whether the address is the asking user's to correct, the published
nanopublication its author's, or the malfunction Nanodash's own. It decides
what the page says about who can act, whether it offers a way to report the
problem, and the HTTP status it is answered with, so that clients other than
browsers can tell these apart too.

Every error page now links home and, where the referrer is one of this
instance's own pages, back to where the user was. The ones that are ours
also offer a pre-filled issue on the tracker, carrying what the user saw,
the failing address, and the version, so a malfunction doesn't dead-end at a
stack trace in the server log.

Callers say which kind they ran into: a malformed nanopublication identifier
is a request to correct, and a query that can't be loaded is its author's to
fix unless the ID held no artifact code at all. Without a kind, the page
falls back to the status the container settled on (that is how web.xml's
/error/404 and /error/500 arrive), and to a malfunction otherwise, since an
error nobody foresaw usually is one.

Closes #616

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@ashleycaselli
ashleycaselli merged commit 47eb95c into master Aug 24, 2026
8 checks passed
@ashleycaselli
ashleycaselli deleted the feat/616-error-page-way-onward branch August 24, 2026 12:33
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 5.12.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Give the error page a way onward

1 participant