0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-11 07:11:32 -05:00

🎉 Add ex/ignoring macro.

This commit is contained in:
Andrey Antukh 2020-10-05 18:18:58 +02:00 committed by Hirunatan
parent c85ae7dbdf
commit 0a34aa6231

View file

@ -31,3 +31,17 @@
(defmacro raise
[& args]
`(throw (error ~@args)))
(defn ignoring*
[f]
(try
(f)
(catch #?(:clj Exception :cljs :default) e
nil)))
;; http://clj-me.cgrand.net/2013/09/11/macros-closures-and-unexpected-object-retention/
;; Explains the use of ^:once metadata
(defmacro ignoring
[& exprs]
`(ignoring* (^:once fn* [] ~@exprs)))