From 9f097026f8eef7eaf6894f8fc4775b2253753a17 Mon Sep 17 00:00:00 2001 From: giles Date: Wed, 1 Apr 2026 10:05:24 +0000 Subject: [PATCH] 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) --- sx/sx/handlers/dispatch.sx | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/sx/sx/handlers/dispatch.sx b/sx/sx/handlers/dispatch.sx index b052e679..aa2f973c 100644 --- a/sx/sx/handlers/dispatch.sx +++ b/sx/sx/handlers/dispatch.sx @@ -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