Hi, I've written a related patch that makes three changes:
1. assert now raises AssertionError, instead of Exception. 2. assert is now overloaded with a second parameter that replaces "Assert failed" in the original message. 3. the (pre- or post-) condition that raised the exception, along with the form responsible, is now reported. Previously: "Caused by: java.lang.Exception: Assert failed: (= % x)" Now: "Caused by: java.lang.AssertionError: Postcondition failed when (bad- fn 2): (= % x)" Assembla seems to be having some problems, so I'm hosting it at http://fanatico.org/better-pre-post.diff until they get that sorted out. Thoughts? On Dec 23, 3:52 pm, Sean Devlin <francoisdev...@gmail.com> wrote: > It would be nice if the exception string stated if it was a pre or > post condition failure at the very least. > > On Dec 23, 5:03 pm, Mark Derricutt <m...@talios.com> wrote: > > > > > 'lo, > > > I was readinghttp://blog.fogus.me/2009/12/21/clojures-pre-and-post/ > > on the new pre and post conditions and seeing that they throw > > java.lang.Exception kinda struck me as a bad smell, esp. when > > integrating with other systems written in Java or another language. > > Forcing upstream clients to catch the top level Exception seems rather > > rude on clojures part. > > > Was there any reason java.lang.Exception was used over say > > java.lang.AssertionError? Or a more specific > > PreConditionAssertionError/PostConditionAssertionError pair? > > > Mark > > > -- > > Pull me down under... -- 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