Permalink
Browse files

MATCH-36: if no matching clause given throw exception

Throw IllegalArgumentException displaying the values we were unable to match.
  • Loading branch information...
1 parent e4982ed commit 63e56f524e60644460a9e43e1312966c42c3a5d5 @swannodette swannodette committed Jun 16, 2013
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/main/clojure/clojure/core/match.clj
@@ -1791,7 +1791,7 @@
(conj (vec (butlast cs)) [last-match a])
;; TODO: throw an exception if :else line not provided - David
(if default
- (conj (vec cs) [last-match nil])
+ (conj (vec cs) [last-match `(throw (IllegalArgumentException. (str "No matching clause: " ~@(interpose " " vars))))])
cs)))]
(pattern-matrix
(vec (map #(apply to-pattern-row %) cs))

0 comments on commit 63e56f5

Please sign in to comment.