Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

one error spits one log #362

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 10 additions & 6 deletions src/clj/quil/middlewares/safe_fns.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@
[quil.util :as u]))

(defn- wrap-fn [name function]
(fn []
(try
(function)
(catch Exception e
(println "Exception in " name " function: " e "\nstacktrace: " (with-out-str (print-cause-trace e)))
(Thread/sleep 1000)))))
(let [save_ex (atom nil)]
(fn []
(try
(function)
(catch Exception e
(let [errstr (str e)]
(when-not (= @save_ex errstr)
(println "Exception in " name " function: " e "\nstacktrace: " (with-out-str (print-cause-trace e)))
(reset! save_ex errstr))
(Thread/sleep 1000) ))))))

(defn- wrap-mouse-wheel [function]
(fn [rotation]
Expand Down