Back
root-cause (clj)
(source)function
(root-cause t)
Returns the initial cause of an exception or error by peeling off all of
its wrappers
Examples
clojure/core.typed
(deftest demunge-test
(is-tc-e (demunge "abc") String
:requires [[clojure.main :refer [demunge]]])
(is-tc-err (demunge "abc") Boolean
:requires [[clojure.main :refer [demunge]]])
(is-tc-err (demunge 1) String
:requires [[clojure.main :refer [demunge]]]))
(deftest root-cause-test
(is-tc-e (root-cause (Exception. "a")) Exception
:requires [[clojure.main :refer [root-cause]]])
(is-tc-err #(root-cause "A")
:requires [[clojure.main :refer [root-cause]]])
(is-tc-err #(root-cause (Exception. "a")) [-> String]
:requires [[clojure.main :refer [root-cause]]]))
typedclojure/typedclojure
(deftest demunge-test
(is-tc-e (demunge "abc") String
:requires [[clojure.main :refer [demunge]]])
(is-tc-err (demunge "abc") Boolean
:requires [[clojure.main :refer [demunge]]])
(is-tc-err (demunge 1) String
:requires [[clojure.main :refer [demunge]]]))
(deftest root-cause-test
(is-tc-e (root-cause (Exception. "a")) Exception
:requires [[clojure.main :refer [root-cause]]])
(is-tc-err #(root-cause "A")
:requires [[clojure.main :refer [root-cause]]])
(is-tc-err #(root-cause (Exception. "a")) [-> String]
:requires [[clojure.main :refer [root-cause]]]))