I'd been shopping around for an error handling kit for Clojure. What I needed was:
* The ability to specify error handlers at the caller's level, that are accessible all the way up the stack from them. * Ability to include more data in an error than just a message and stack trace. That data should be accessible to handlers. * The ability to specify pre-defined methods of recovering from an error, at any point on the stack between the caller and the origin of the error. The caller can select the recovery method by name. * Ability to handle errors by type, in a hierarchical fashion, similar to java's catch. * Compatibility with java exceptions. * Ability to nest hander forms * No AOT compilation if I can help it. Chouser's error-kit offers this, but Chouser himself told me I probably shouldn't use it unless I needed all the features, like continue-with. I didn't need continue-with, and I figure if the author warns you away from a lib, probably best to listen :) I also took a look at clojure.contrib.condition, but it doesn't allow you to specify pre-defined recoveries, and requires AOT compilation. So I took a stab at it myself: https://gist.github.com/745223 It's not polished at all yet - please don't use it for anything important! I wanted to see if you all had any suggestions or criticisms before I went any further. Changes to the gist are most welcome :) Some notes: * Uses javax.naming.NamingException internally - because it is an existing exception class that has a getter/setter that takes Object. This is just a hack to store clojure types in the exception and have them travel down the stack. I wanted to avoid adding my own java exception class like clojure.contrib.condition had to do. I could still do that without a lot of changes. * Makes use of 'binding' internally to store handlers. That allows nested with-handler forms. * Adding recoveries to a java exception is not working, but it should be a simple fix once i track down the problem. Jeff -- 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