Lazy seqs were designed to work that way.  See the implementation in
clojure.lang.LazySeq.  RuntimeExceptions get thrown whenever Exceptions are
caught.  I guess you find it unhelpful?

Dan

On Wed, Aug 26, 2009 at 11:47 PM, Tim Snyder <tsnyder...@gmail.com> wrote:

>
> I'm trying to understand how laziness affects exception handling.  I
> keep finding my exceptions wrapped in RuntimeExceptions.
>
> If I have code that just throws an exception, I get what I'd expect:
> (throw (Exception. "Plain Exception")) -->
> Plain Exception
>  [thrown class java.lang.Exception]
>
> On the other hand if I make the exception lazy, it is always wrapped
> in a RuntimeException:
> (lazy-seq
>  [(throw (Exception.
>     "NotPlainException"))])  -->
> java.lang.Exception: NotPlainException
>  [Thrown class java.lang.RuntimeException]
>
> This of course makes it harder to deal with the exceptions.  I've
> looked through the stack traces but can't see any solution.  Is this
> due to the Java difference between checked and unchecked exceptions?
> Is there a reasonable way to work around it?  Doall has no effect.
>
> Thanks for your help,
> Tim
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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