emezeske/lein-cljsbuild — Issue #8: Cannot compile try-catch code blocks
Author: kumarshantanu
Created: 2012-01-13 12:09:08+00:00
State: open

ClojureScript's `try-catch` is different from Clojure's:
https://github.com/clojure/clojurescript/wiki/Exception-Handling

`lein-cljsbuild` seems to be using the Clojure compiler to compile CLJS sources and as a consequence it throws exception when compiling .cljs files with valid CLJS try-catch blocks complaining about `"Unsupported binding form.."`. When compiling with a placeholder (shown below) or `Exception e` instead of `e _`, it produces JavaScript that throws exception about the runtime (missing variable) in the browser.

```clojure
(ns foo
(:require [cljs.reader :as reader]))

(defn bar []
(try
(reader/read-string "(+ 78 #\\.// 45)")
(catch e _
"Some error occured")))
```

It is entirely possible that I do not know well about this topic; so please conduct your own experiments to assert the situation.