The Clojure run time throws IllegalArgumentException in a lot of
different places. It does also throw RuntimeException
in several places. It traps exceptions generically (catch (Exception e),
catch (Throwable t) ) and may have thrown a RuntimeException back
to upper layers instead of the original\ IllegalArgumentException.

Did you print the RuntimeException  ? There might a be a text messages
there that can tell us where it came from within the Clojure run time.

Luc
On Thu, 2009-06-11 at 10:12 -0700, peg wrote:

> Hi clojurians,
> 
> I was happily clojure-coding whent I tried to catch a exception in a
> thrown deeply in a function.
> 
> After looking for the fact that the IllegalArgumentException wasn't
> catch, I added a catch RuntimeException to my catch list ... and that
> worked of course.
> 
> Here is the simplified case:
> 
> (defn throw-error [arg]
>  (throw (IllegalArgumentException. (str arg))))
> 
> (try
>   (let [ test
>           (into {}
>               (map (fn[x] (if (= 5 x) (throw-error x) [x x]))
>                  [1 2 3 4 5]))  ]
>    (str "NO PB " name))
>   (catch IllegalArgumentException e (.getMessage e))
>   (catch RuntimeException e (str "RT" (.getMessage e)))
> )
> 
> If you comment the RuntimeException catch, the exception is not
> catched.
> 
> I don't understand why IllegalArgumentException is not catched ...
> 
> Somebody could tell me ?
> 
> Thanks
> Phil
> 
> 
> 
> > 
> 

Luc Préfontaine

Armageddon was yesterday, today we have a real problem...

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