In my communication layer I have a need to be able to catch ANY javascript exception, log it down and proceed as I normally would do. Current syntax for catching exceptions in C
I think I've just found the solution in this link https://groups.google.com/forum/#!topic/clojure/QHaTwjD4zzU
I copy the contents here: This solution was published by Herwig Hochleitner
try in clojurescript is actually a macro that uses the builtin try* and adds type dispatch. So to catch everything, just use (try* ... (catch e ...)). This maps directly to javascript's try.
And here is my implementation working now:
(defn is-dir? [the_dir]
(try*
(if-let [stat (.statSync fs the_dir )]
(.isDirectory stat)
false)
(catch e
(println "catching all exceptions, include js/exeptions")
false
)
)
)
I hope it helps you
Juan