So far this is fantastic! And I haven't even got around to playing with the restart mechanism :) I'm using it in Spinoza to provide contextual errors (malformed slot list, missing base class etc.). I notice the contrib libraries in general are very good at throwing exceptions so that consumers have some idea of what is going on. error-kit one ups this practice by providing a standardized way to define your errors up front and presents a definition system that removes the need to instantiate ugly Java Exceptions inline with your code. (defn protocol-fn [protocol-name fn-name] (let [protocol-keyword (symbol-to-keyword protocol-name) dispatch (partial protocol-dispatch protocol-keyword)] `(do (defmulti ~fn-name ~dispatch) (defmethod ~fn-name [:spinoza/object nil] [~'obj] (raise *missing-protocol-method-error* ~'obj ~(str protocol-name) ~(str fn-name))))))
Where the error is defined as you've described: (deferror *missing-protocol-method-error* [*spinoza-error*] [obj protocol-name method-name] {:msg (str (:tag obj) " class does not implement " method-name " from protocol " protocol-name)}) Sweet! That said I do have one minor annoyance and that is the need to leave an empty bracket if you want to create a new error without inheriting from a previously defined error. Very minor. Will provide feedback on restarts when I get there. --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---