From 24f5376bf9bb2f466d532f5174dd5161cc5e3a3a Mon Sep 17 00:00:00 2001 From: Chas Emerick Date: Fri, 10 Aug 2012 09:19:12 -0400 Subject: [PATCH] add :default write-bencode method in order to throw a useful exception --- src/main/clojure/clojure/tools/nrepl/bencode.clj | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/clojure/clojure/tools/nrepl/bencode.clj b/src/main/clojure/clojure/tools/nrepl/bencode.clj index 84c83c2..86ec5aa 100644 --- a/src/main/clojure/clojure/tools/nrepl/bencode.clj +++ b/src/main/clojure/clojure/tools/nrepl/bencode.clj @@ -325,6 +325,10 @@ (.isArray (class thing))) :list))) +(defmethod write-bencode :default + [output x] + (throw (IllegalArgumentException. (str "Cannot write value of type " (class x))))) + ;; The following methods should be pretty straight-forward. ;; ;; The easiest case is of course when we already have a byte array.