Created
September 27, 2011 20:56
-
-
Save nathanmarz/1246228 to your computer and use it in GitHub Desktop.
Exception cause predicate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 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