Handler errors throw instead of returning styled divs

api and call-handler now use (error ...) for not-found and method
mismatch, so error boundaries catch them properly instead of
rendering error messages as page content.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-01 10:05:24 +00:00
parent 4ea43e3659
commit 9f097026f8

View File

@@ -6,10 +6,7 @@
((handler-key (str "handler:ex-" slug)) (hdef (env-get handler-key)))
(if
(nil? hdef)
(div
:class "p-8"
(h2 :class "text-rose-600 font-semibold" "Handler not found")
(p :class "text-stone-500" (str "No handler: " handler-key)))
(error (str "Handler not found: " handler-key))
(call-handler hdef)))))
(define
@@ -28,8 +25,7 @@
(and
(not (= handler-method "GET"))
(not (= req-method handler-method)))
(div
:class "p-4 text-rose-600"
(error
(str
"Method not allowed: expected "
handler-method