Skip to content

Instantly share code, notes, and snippets.

@nathanmarz
Created September 27, 2011 20:56
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nathanmarz/1246228 to your computer and use it in GitHub Desktop.
Save nathanmarz/1246228 to your computer and use it in GitHub Desktop.
Exception cause predicate
;; Determine if any of the causes of the exception was of the specified type
(defn exception-cause? [klass ^Throwable t]
(->> (iterate #(.getCause ^Throwable %) t)
(take-while identity)
(some (partial instance? klass))
boolean))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment