Add clojure.stacktrace (#209)

This commit is contained in:
Nate Sutton 2020-01-02 02:29:26 -06:00 committed by Michiel Borkent
parent 0362ecb7f6
commit b16e2812e0
2 changed files with 11 additions and 3 deletions

View file

@ -78,4 +78,11 @@
(print-stack-trace tr n)
(when-let [cause (.getCause tr)]
(print "Caused by: " )
(recur cause n))))
(recur cause n))))
(def stacktrace-namespace
{'root-cause root-cause
'print-trace-element print-trace-element
'print-throwable print-throwable
'print-stack-trace print-stack-trace
'print-cause-trace print-cause-trace})

View file

@ -8,7 +8,7 @@
[babashka.impl.clojure.core :refer [core-extras]]
[babashka.impl.clojure.java.io :refer [io-namespace]]
[babashka.impl.clojure.java.shell :refer [shell-namespace]]
[babashka.impl.clojure.stacktrace :refer [print-stack-trace]]
[babashka.impl.clojure.stacktrace :refer [stacktrace-namespace print-stack-trace]]
[babashka.impl.csv :as csv]
[babashka.impl.pipe-signal-handler :refer [handle-pipe! pipe-signal-received?]]
[babashka.impl.repl :as repl]
@ -228,7 +228,8 @@ Everything after that is bound to *command-line-args*."))
'clojure.java.io io-namespace
'clojure.core.async async-namespace
'clojure.data.csv csv/csv-namespace
'cheshire.core cheshire-core-namespace})
'cheshire.core cheshire-core-namespace
'clojure.stacktrace stacktrace-namespace})
(def bindings
{'java.lang.System/exit exit ;; override exit, so we have more control