Skip to content

Commit

Permalink
Merge pull request #50 from micha/less-ugly-maybe
Browse files Browse the repository at this point in the history
Make a little less ugly :)
  • Loading branch information
Paudi Moriarty committed Nov 15, 2016
2 parents 28c71c9 + 9dd5b30 commit 4f0c19f
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/pretty/plugin.clj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
(repl/install-pretty-exceptions))


(def ^:private warning (atom true))
;; Ugly! But necessary since middleware gets invoked more than once for some unknown reason.
(def ^:private print-warning
(delay (main/warn "Unable to enable pretty exception reporting, as io.aviso/pretty is not a project dependency.")))

(defn middleware
"Automatically adds the :injections that enable Pretty."
Expand All @@ -31,9 +33,5 @@
(println "Error loading io.aviso/pretty support:"
(or (.getMessage t#)
(type t#))))))
(do
;; Ugly! But necessary since middleware gets invoked more than once for some unknown reason.
(when (compare-and-set! warning true false)
(main/warn "Unable to enable pretty exception reporting, as io.aviso/pretty is not a project dependency."))
project)))
(do @print-warning project)))

0 comments on commit 4f0c19f

Please sign in to comment.