Hey all,

I had a situation where a source file wouldn't load and the error
message was unhelpful:

java.lang.IllegalArgumentException: Too many arguments to struct
constructor (source-file.clj:0)

So, I threw together a quick hack to print the call stack:

(defn callstack-str [thrown]
          (let [stk (new java.io.StringWriter)
                        pw (new java.io.PrintWriter stk)]
                (. thrown (printStackTrace pw))
                (str (. stk (toString)))))

(defn lf [filename]
          (try
                (load-file filename)
                (catch java.lang.Throwable e
                           (print (callstack-str e)))))

As usual, I'm sure there's a better way, so I'd appreciate hearing
about it.

Jim
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to