John Harrop <[email protected]> writes:
> The exception is being transformed. Eval and just about anything using
> closures -- just about any delayed evaluation, in other words -- wraps
> exceptions in RuntimeException for some reason. Even if they already were
> RuntimeExceptions (and InterruptedException isn't).
Interesting. Doesn't seem to jive with what I'm seeing though. Why
doesn't the error message mention the RuntimeException?
user=> (try (eval '(throw (InterruptedException.)))
(catch InterruptedException _))
java.lang.InterruptedException (NO_SOURCE_FILE:5)
It looks like it's actually a subclass of Exception instead:
user=> (eval '(throw (InterruptedException.)))
java.lang.InterruptedException (NO_SOURCE_FILE:7)
user=> (class *e)
clojure.lang.Compiler$CompilerException
user=> (.getSuperclass (class *e))
java.lang.Exception
user=> (.getCause *e)
#<InterruptedException java.lang.InterruptedException>
I'm on 1.1-SNAPSHOT, so maybe RuntimeException was 1.0 behaviour? In
either case, it seems that the repl is hiding information from us. Or at
the very least it's abstracting it away in a very leaky fashion.
Not a big deal with eval usage (you should be prepared for trickiness if
you use eval), but if this happens when calling closures, displaying a
different error from the one that was actually raised is hardly
straightforward.
-Phil
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
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
-~----------~----~----~----~------~----~------~--~---