(defisland
  ()
  (let
    ((throw? (signal false)))
    (div
      (~tw :tokens "rounded border border-violet-200 bg-violet-50 p-4 my-4")
      (div
        (~tw :tokens "flex items-center gap-3 mb-3")
        (button
          (~tw :tokens "px-3 py-1 rounded bg-red-600 text-white text-sm font-medium hover:bg-red-700")
          :on-click (fn (e) (reset! throw? true))
          "Trigger Error")
        (button
          (~tw :tokens "px-3 py-1 rounded bg-stone-300 text-stone-700 text-sm hover:bg-stone-400")
          :on-click (fn (e) (reset! throw? false))
          "Reset"))
      (error-boundary
        (fn
          (err retry-fn)
          (div
            (~tw :tokens "p-3 bg-red-50 border border-red-200 rounded")
            (p
              (~tw :tokens "text-red-700 font-medium text-sm")
              "Caught: "
              (error-message err))
            (button
              (~tw :tokens "mt-2 px-3 py-1 rounded bg-red-600 text-white text-sm hover:bg-red-700")
              :on-click (fn (e) (do (reset! throw? false) (invoke retry-fn)))
              "Retry")))
        (do
          (when (deref throw?) (error "Intentional explosion!"))
          (p
            (~tw :tokens "text-sm text-green-700")
            "Everything is fine. Click \"Trigger Error\" to throw."))))))
