trackslash
TRACK-82 P2

Show the branded error page instead of plain-text errors on page loads

0
All issues

Description

Split out of the TRACK-81 brand audit.

Problem

A full page load of a missing, forbidden or broken portal page renders Go's plain-text body (not found, forbidden, internal error) in the browser's default monospace font, with no shell, sidebar or brand. For example, open /{owner}/projects/NOPE directly.

The cause is that writeUIStoreError and writeUIInternalError write plain-text http.Error responses. Those are right for htmx fragments, where htmx doesn't swap 4xx/5xx bodies, but not for browser navigations. Unknown URLs already get the branded error-panel inside the shell (uiNotFound). Known routes whose lookup fails don't.

Expected

  • A browser page navigation (a GET that accepts text/html and isn't an htmx request) that fails with one of these plain-text errors renders error-panel inside the shell, with the same status code and the signed-in sidebar.
  • htmx, fetch, image, websocket and API requests keep today's plain-text bodies.

GitHub

0

No branches or pull requests linked.

Comments

1
Bradley

Fixed in https://github.com/badbundle/track-slash-app/pull/173 (merged as abaa233).

The new uiErrorPages middleware in the signed-in route group turns a plain-text 4xx/5xx into the shell's error-panel when it answers a browser page navigation. The status code is unchanged and the visitor keeps their own sidebar. htmx, fetch, image and websocket requests keep the plain-text body. The copy lives in uiErrorPageFor.