Unfortunately:
So we have to use a separate namespace and hide everything behind reader conditionals.
Usage is:
#?(:clj [cli-matic.platform-macros :refer [try-catch-all]]
:cljs [cli-matic.platform-macros :refer-macros [try-catch-all]] )
This was a real PITA, man.
## Macros shared between CLJ and CLJS. Unfortunately: - Macros must be in a separate file (for CLJS) - Macros have a different import syntax (CLJS) - Macros defined in .clj will STILL be loaded by CLJS and will fail big time. So we have to use a separate namespace and hide everything behind reader conditionals. Usage is: #?(:clj [cli-matic.platform-macros :refer [try-catch-all]] :cljs [cli-matic.platform-macros :refer-macros [try-catch-all]] ) This was a real PITA, man.
(try-catch-all f onErr)
This creates a try-catch block that either traps Throwable on the JVM or :default on Node.
Use:
(try-catch-all (/ 1 0) (fn [x] 0))
So both expressions must be surrounded by round parentheses.
This creates a try-catch block that either traps Throwable on the JVM or :default on Node. Use: `(try-catch-all (/ 1 0) (fn [x] 0))` So both expressions must be surrounded by round parentheses.
See the .clj docs.
See the .clj docs.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close