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

+1 vote
in Errors by
closed by

When you call a {{Keyword}} with the wrong number of arguments, the error message does not report how many arguments were passed:

(:kw "one" "two" "three") => java.lang.IllegalArgumentException: Wrong number of args passed to keyword: :kw

compare to calling an {{IFn}}, which does show the number of arguments passed:

(name "one" "two" "three") => clojure.lang.ArityException: Wrong number of args (3) passed to: core/name

The latter error message is more clear and makes it easier to debug.

The attached patch re-uses the {{ArityException}} class used elsewhere to generate error messages in the latter form when calling a keyword with the wrong number of arguments.

Addresses CLJ-1067

Patch: keyword-arity-exception-03.patch

Screened by: Alex Miller

closed with the note: Fixed in 1.11.0-alpha2

17 Answers

0 votes
by

Comment made by: marc

Thanks Alex

0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJ-2350 (reported by marc)
...