          ~default-expr)))
   ([method-keyword request expr default-expr]
     (when-not (valid-method-keys method-keyword)
-      (throw (IllegalArgumentException.
-               (str "Expected a method key (" valid-method-keys "), but found (" (class method-keyword) ") "
-                 (pr-str method-keyword)))))
+      (expected (str "a method key (" valid-method-keys ")") method-keyword))
     `(if (identical? ~method-keyword (:request-method ~request))
        ~expr
        ~default-expr)))

(ns calfpath.internal
  (:require [clojure.string :as str]))


(defn parse-uri-template

    (and (vector? uri-pattern-or-template)
      (every? (some-fn string? keyword?)
        uri-pattern-or-template))          uri-pattern-or-template
    :otherwise                             (expected "a string URI pattern or a parsed URI template"
                                             uri-pattern-or-template)))


(def valid-method-keys #{:get :head :options :put :post :delete})
