Exception handling

(defn method-with-exception []
  (try
    (throw (ex-info "test exception" {:step 1}))
    (catch Exception e
      ;; implementation of any partial processing
      ;; and send error to the calling code
      (println "partial processing of" (ex-data e))
      (throw e))))

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

;; or wrap it, keeping the original as the cause
(try
  (try
    (method-with-exception)
    (catch Exception e
      (throw (ex-info "wrapped" {} e))))
  (catch Exception e
    (println (ex-message e) "<-" (ex-message (ex-cause e)))))