Thanks for that. I couldn't figure this one out. But using your suggestion, 
I finally get what I expected: 

(try (/ 4 0) (catch ArithmeticException e (println (ancestors (type e)))))
#{java.lang.Exception java.lang.Throwable java.lang.RuntimeException 
java.lang.Object java.io.Serializable}



On Tuesday, March 7, 2017 at 7:15:07 PM UTC-5, Gary Trakhman wrote:
>
> Turns out ancestors works on the class, not the instance:
> > (ancestors ArithmeticException)
> #{java.lang.Throwable java.io.Serializable java.lang.Exception 
> java.lang.RuntimeException java.lang.Object}
>
> > (ancestors (new ArithmeticException))
> nil
>
>
> On Tue, Mar 7, 2017 at 7:05 PM <piast...@gmail.com <javascript:>> wrote:
>
>> This gives me nil:
>>
>> (try (/ 4 0) (catch Exception e (println (parents e))))
>>
>> This too:
>>
>> (try (/ 4 0) (catch Exception e (println (ancestors e))))
>>
>> This too:
>>
>> (try (/ 4 0) (catch ArithmeticException e (println (ancestors e))))
>>
>> How is this possible? Shouldn't Exception be an ancestor? 
>>
>> Or, more generally, shouldn't something be a parent? 
>>
>>
>>
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com 
>> <javascript:>
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@googlegroups.com <javascript:>
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to clojure+u...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to