Prerequisites that throw exceptions

marick edited this page Apr 27, 2012 · 1 revision
Clone this wiki locally

Available in 1.4

You can ask that a prerequisite throw an exception when it's called:

(unfinished f)

(defn counter [n]
  (try
    (f n)
  (catch Exception ex
    0)))

(fact
  (counter 4) => 0
  (provided
    (f 4) =throws=> (NullPointerException.)))