summaryrefslogtreecommitdiff
path: root/cgithub/views/layout.eta
diff options
context:
space:
mode:
authorJoe Mou <dev@mou.fo>2026-09-03 23:08:08 -0400
committerJoe Mou <dev@mou.fo>2026-09-03 23:28:52 -0400
commit5bfe8b345d2ee92111a2363321a248adb4f5195a (patch)
treeda88acbd16519633e3a38627c343371c035a03eb /cgithub/views/layout.eta
parent439f783c9e3b18519505d1ad6b8533bea081cca0 (diff)
Handle route errors in middleware
Every page route wrapped its scrape in tryRender, which awaited the promise, rendered the template on success, and turned a failure into a redirect or an error page. Hono's onError does that mapping for all of them at once, so handlers now await their scrape inline and both wrappers are gone. Fragments under /api/ still fail as an empty body rather than a page; onError checks for them first, since a fragment turns a redirect into a 404 instead of following it. RedirectError becomes an abstract base with InternalRedirectError and ExternalRedirectError under it, so the handler dispatches on the type instead of sniffing the location for an https:// prefix. One behavior change: a thrown value that is not an Error no longer renders error.eta, because Hono only routes Error instances to onError. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QERwoRJhuqMhKzzCUW4Skv
Diffstat (limited to 'cgithub/views/layout.eta')
0 files changed, 0 insertions, 0 deletions