I am just coming to ClojureScript trying to have CLI-matic work on it. My biggest pain point, at the moment, is try/catch blocks and throw calls. I would like to have as much logic as possible in a common .cljc file, and defer to functions help in .clj/.cljs the calling of platform-specific features.
I mean, as exceptions are platform-specific, how do you handle this case for code that is supposed to be platform-agnostic? write your own try/catch and throws macros, that resolve differently for each platform? or is there something ready? try/catch block are control, so I’d hate to port a full function just because there is a try/catch block in it, or it needs to blow up on errors…
I’d suggest using portable ex-info and related functions (ex-data, ex-message, ex-cause) for creating and pulling apart exceptions when possible.
For catching exceptions I think something like https://dev.clojure.org/jira/browse/CLJ-1293 would ultimately help in writing portable code, but in the meanwhile reader conditionals seem to be the way to go.
It’s probably worth mentioning that ex-message and ex-cause are new in Clojure in the 1.10 prerelease builds, although they’ve been in ClojureScript for a while. So they’re not portable for pre-1.10 Clojure versions.