Back
repl-exception (clj)
(source)function
(repl-exception throwable)
Returns the root cause of throwables
Examples
clojure
(ns clojure.test-clojure.main
(:use clojure.test
[clojure.test-helper :only [platform-newlines]])
(:require [clojure.main :as main]))
;argh - test fragility, please fix
#_(deftest repl-exception-safety
(testing "catches and prints exception on bad equals"
(is (re-matches #"java\.lang\.NullPointerException\r?\n"
(run-repl-and-return-err
"(proxy [Object] [] (equals [o] (.toString nil)))")))))
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 repl-exception-test
(is-tc-e #(repl-exception (Exception. "a"))
:requires [[clojure.main :refer [repl-exception]]])
(is-tc-err #(repl-exception "A")
:requires [[clojure.main :refer [repl-exception]]]))
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 repl-exception-test
(is-tc-e #(repl-exception (Exception. "a"))
:requires [[clojure.main :refer [repl-exception]]])
(is-tc-err #(repl-exception "A")
:requires [[clojure.main :refer [repl-exception]]]))