Hi Jonathan,

I am moving the trace contrib stuff to 1.3. I would like to include your 
trace-forms
macro in it. Feeling ok with this ? Comments ? 

The issues you underlined are not runtime errors, they are compilation errors.
There's not much you can do to trap these.
The macro is still valuable for runtime tracing.

Luc P.

On Mon, 12 Sep 2011 11:31:39 +0200
Jonathan Fischer Friberg <odysso...@gmail.com> wrote:

> Hello,
> 
> I made a small macro, if anyone is interested.
> https://gist.github.com/1209498
> 
> It wraps one or more forms and if an exception is thrown,
> prints the form that caused it, and throws the exception itself.
> 
> Examples:
> 
> user=> (trace-forms 3)
> 3
> 
> user=> (trace-forms (+ 6 (/ 9 0)))
> java.lang.ArithmeticException: Divide by zero (NO_SOURCE_FILE:9)
> Form failed: (/ 9 0)
> Form failed: (+ 6 (/ 9 0))
> 
> user=> (trace-forms (let [a 0 b (/ 9 a)] b))
> java.lang.ArithmeticException: Divide by zero (NO_SOURCE_FILE:75)
> Form failed: (/ 9 a)
> Form failed: (let* [a 0 b (/ 9 a)] b)
> Form failed: (let [a 0 b (/ 9 a)] b)
> 
> Issues:
> 
> user=> (trace-forms (let [b (/ 9 a)] b))
> java.lang.Exception: Unable to resolve symbol: a in this context
> (NO_SOURCE_FILE:94)
> 
> user=> (trace-forms (let [a (java.lang.DoesNotExist.)] a))
> java.lang.ClassNotFoundException: java.lang.DoesNotExist
> (NO_SOURCE_FILE:93)
> 
> ----
> 
> Thoughts?
> 
> Jonathan
> 



-- 
Luc P.

================
The rabid Muppet

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to