方法抛出异常

异常处理

;; 任何函数都可能抛出异常:Clojure 没有受检异常,
;; 签名中也根本没有 "throws"
(defn method-with-exception []
  (throw (ex-info "test exception" {})))

(try
  (method-with-exception)
  (catch Exception e
    (println "Error happened:" (ex-message e))))