Welcome! Please see the About page for a little more info on how this works.

0 votes
in Spec by

Here we get a NullPointerException because although we do have a spec for {{foo}}, we don't have an implementation for it, a more descriptive error message would help.

`
(require '[clojure.spec.alpha :as s])

(s/fdef foo :args (s/cat :x int?) :ret int?)
=> user/foo

(s/exercise-fn foo) NullPointerException clojure.core/apply (core.clj:657) ``

Proposed: Check for a nil function and throw.

Patch: clj-2190.patch

3 Answers

0 votes
by

Comment made by: stu

If we are going to handle this case, can we also include the name of the offending symbol in the error message?

0 votes
by

Comment made by: alexmiller

The sym-or-f arg is resolved to nil before exercise-fn is invoked, so we have no symbol to report by that point.

0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJ-2190 (reported by alex+import)
...