How does one print the stacktrace from slingshot?

115 views
Skip to first unread message

Lawrence Krubner

unread,
Oct 9, 2015, 6:00:35 AM10/9/15
to Clojure

I'm trying to use Slingshot. I would like to print the stacktrace. If I do: 

         (timbre/log :trace " the stack trace via slingshot-support " (slingshot-support/stack-trace))


I get: 

the stack trace via slingshot-support  [Ljava.lang.StackTraceElement;@72ee66cd

How do I get what is in StackTraceElement? 

I looked at these articles: 



but I could not figure out how to translate that to what I'm doing. 

I also tried: 

         (timbre/log :trace " the true stack trace: "(.getStackTrace (:throwable &throw-context)))

but that gives me: 

 the true stack trace:  [Ljava.lang.StackTraceElement;@3733df3

I can not figure out how to see what is in StackTraceElement. 

If I search on Google for "slingshot print stacktrace" I can not find any examples: 






Lawrence Krubner

unread,
Oct 9, 2015, 6:15:33 AM10/9/15
to Clojure
Ah, not enough sleep. I was catching it a lower level and re throwing it in a form that tripped me up. Got rid of low level catch and did: 

         (timbre/log :trace " the true stack trace: " (stack/parse-exception (:throwable &throw-context)))

using clj-stacktrace and all is good. 

Marc O'Morain

unread,
Oct 9, 2015, 6:16:23 AM10/9/15
to clo...@googlegroups.com, Clojure
If you pass (:throwable &throw-context) as an arg before the string it will print the stack trace:

(timbre/log :trace (:throwable &throw-context)  "the true stack trace: ")




--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Lawrence Krubner

unread,
Oct 9, 2015, 6:47:35 AM10/9/15
to Clojure

Thank you.
Reply all
Reply to author
Forward
0 new messages