throw raises an exception. ex-info builds one that carries a message and a data map. catch selects by type. ExceptionInfo is the type ex-info produces. finally runs on the way out, which is the usual replacement for Go's defer.
(defnparse[s](let[n(parse-longs)](if(nil?n)(throw(ex-info"not a number"{:inputs}))n)))(require'[clojure.string:asstring])(defnrun[s](try(println"value"(parses))(catchExceptionInfoe(println"error"(first(string/split-lines(ex-messagee)))(pr-str(ex-datae))))(finally(println"done"s))))
Go functions do not raise for an ordinary failure. They return an error value, covered on the multiple-return-values page. panic and recover are not the Glojure control-flow tools. Catch with go/any when the type does not matter.
(run"42")(run"nope")
finally prints after both the success path and the catch path.
$ glj exceptions.glj
value 42done 42error not a number {:input "nope"}done nope