Skip to content

Commit

Permalink
Use defonce to set up error frame across reloads.
Browse files Browse the repository at this point in the history
  • Loading branch information
daveray committed Nov 9, 2011
1 parent 5338c5f commit 6347662
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/seesaw/debug.clj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
(:require [seesaw.core :as core]))


(def ^{:private true} error-frame
(defonce ^{:private true} error-frame
(delay
(core/frame
:title "Seesaw - Unhandled Exception"
Expand All @@ -41,10 +41,9 @@
(defn- set-error-frame-content [frame event ^java.lang.Throwable throwable]
(let [h (core/select frame [:#header])
e (core/select frame [:#event])
t (core/select frame [:#throwable])
source (core/to-widget event)]
t (core/select frame [:#throwable])]
(-> h
(core/text! (format "Unhandled exception from %s" (if source (core/id-of source) "unknown"))))
(core/text! (format "Unhandled exception at %s" (java.util.Date.))))
(->
(core/text! e (str event))
(core/scroll! :to :top))
Expand All @@ -64,7 +63,7 @@
core/show!
(core/move! :to-front)))

(def ^{:private true :tag seesaw.ExceptionHandler} handler (seesaw.ExceptionHandler.))
(defonce ^{:private true :tag seesaw.ExceptionHandler} handler (seesaw.ExceptionHandler.))

(defn debug!
"Install a custom exception handler which displays a window with event and
Expand Down

0 comments on commit 6347662

Please sign in to comment.