From 2fb131fe7bc6db8422f79aa6aab67b3a40981acd Mon Sep 17 00:00:00 2001 From: Philippa Markovics Date: Tue, 8 Oct 2024 15:59:01 +0200 Subject: [PATCH] Prio Clojure errors over render errors --- src/nextjournal/clerk/render.cljs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/nextjournal/clerk/render.cljs b/src/nextjournal/clerk/render.cljs index 3d1f7999c..ee8b901eb 100644 --- a/src/nextjournal/clerk/render.cljs +++ b/src/nextjournal/clerk/render.cljs @@ -585,7 +585,6 @@ (defn render-errors-overlay [errors] (let [!expanded-at (r/atom {})] - (js/console.log errors) [:div.fixed.bottom-0.left-0.font-mono.w-screen.z-20 [:div.text-4xl.absolute.left-1 {:style {:transform "rotate(-15deg)" @@ -596,8 +595,11 @@ [:div.flex.ml-7 [:div.pl-4.pr-3.pt-1.rounded-t.bg-red-100.text-red-600.text-sm.font-bold.relative.border-t.border-l.border-r.border-red-200 {:style {:bottom -1}} - "Errors"]] - (map throwable-view errors)])) + "Render Errors"]] + (into [:div] + (map (fn [e] + [throwable-view e])) + errors)])) (defn clojure-exception-overlay [presented-value] (let [!expanded-at (r/atom {})] @@ -621,11 +623,10 @@ [connection-status status]) (when-let [status (:status @!doc)] [exec-status status])] - (when-let [render-errors (not-empty @!render-errors)] - [render-errors-overlay render-errors]) - (when-let [{:as wrapped-value :nextjournal/keys [blob-id]} (get-in @!doc [:nextjournal/value :error])] - ^{:key blob-id} - [with-fetch-fn wrapped-value clojure-exception-overlay]) + (if-let [{:as wrapped-value :nextjournal/keys [blob-id]} (get-in @!doc [:nextjournal/value :error])] + ^{:key blob-id} [with-fetch-fn wrapped-value clojure-exception-overlay] + (when-let [render-errors (not-empty @!render-errors)] + [render-errors-overlay render-errors])) (when (:nextjournal/value @!doc) [inspect-presented @!doc]) (into [:<>]