File tree 1 file changed +6
-4
lines changed
1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 15
15
:author " Stuart Sierra" }
16
16
clojure.stacktrace )
17
17
18
+ (set! *warn-on-reflection* true )
19
+
18
20
(defn root-cause
19
21
" Returns the last 'cause' Throwable in a chain of Throwables."
20
22
{:added " 1.1" }
21
- [tr]
23
+ [^Throwable tr]
22
24
(if-let [cause (.getCause tr)]
23
25
(recur cause)
24
26
tr))
25
27
26
28
(defn print-trace-element
27
29
" Prints a Clojure-oriented view of one element in a stack trace."
28
30
{:added " 1.1" }
29
- [e]
31
+ [^StackTraceElement e]
30
32
(let [class (.getClassName e)
31
33
method (.getMethodName e)]
32
34
(let [match (re-matches #"^([A-Za-z0-9_.-]+)\$ (\w +)__\d +$" (str class))]
39
41
" Prints the class and message of a Throwable. Prints the ex-data map
40
42
if present."
41
43
{:added " 1.1" }
42
- [tr]
44
+ [^Throwable tr]
43
45
(printf " %s: %s" (.getName (class tr)) (.getMessage tr))
44
46
(when-let [info (ex-data tr)]
45
47
(newline )
71
73
" Like print-stack-trace but prints chained exceptions (causes)."
72
74
{:added " 1.1" }
73
75
([tr] (print-cause-trace tr nil ))
74
- ([tr n]
76
+ ([^Throwable tr n]
75
77
(print-stack-trace tr n)
76
78
(when-let [cause (.getCause tr)]
77
79
(print " Caused by: " )
You can’t perform that action at this time.
0 commit comments