mirror of
https://github.com/penpot/penpot.git
synced 2025-03-11 23:31:21 -05:00
🎉 Add ex/ignoring
macro.
This commit is contained in:
parent
c85ae7dbdf
commit
0a34aa6231
1 changed files with 14 additions and 0 deletions
|
@ -31,3 +31,17 @@
|
||||||
(defmacro raise
|
(defmacro raise
|
||||||
[& args]
|
[& args]
|
||||||
`(throw (error ~@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)))
|
||||||
|
|
Loading…
Add table
Reference in a new issue