Clojure

Improve error message when calling a keyword with the wrong number of arguments

Details

  • Type: Enhancement Enhancement
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: Release 1.9
  • Fix Version/s: Release 1.11
  • Component/s: None
  • Labels:
  • Patch:
    Code and Test
  • Approval:
    Screened

Description

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

  1. keyword-arity-exception.patch
    03/May/18 7:51 AM
    8 kB
    Marc O'Morain
  2. keyword-arity-exception-01.patch
    04/May/18 6:34 AM
    8 kB
    Marc O'Morain
  3. keyword-arity-exception-02.patch
    07/May/18 3:25 PM
    8 kB
    Marc O'Morain
  4. keyword-arity-exception-03.patch
    09/Jul/18 5:40 PM
    7 kB
    Marc O'Morain

Activity

Marc O'Morain made changes -
Field Original Value New Value
Attachment keyword-arity-exception.patch [ 18100 ]
Marc O'Morain made changes -
Description When you call a {{Keyword}} with the wrong number of arguments, the error message does not report how many arguments were passed:

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

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

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

The later 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 later form when calling a keyword with the wrong number of arguments.

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

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

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

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

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.patch
Attachment keyword-arity-exception.patch [ 18101 ]
Alex Miller made changes -
Approval Prescreened [ 10220 ]
Description When you call a {{Keyword}} with the wrong number of arguments, the error message does not report how many arguments were passed:

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

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

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

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.patch
When you call a {{Keyword}} with the wrong number of arguments, the error message does not report how many arguments were passed:

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

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

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

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.patch

*Prescreened by:* Alex Miller
Labels errormsgs
Alex Miller made changes -
Approval Prescreened [ 10220 ] Triaged [ 10120 ]
Description When you call a {{Keyword}} with the wrong number of arguments, the error message does not report how many arguments were passed:

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

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

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

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.patch

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

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

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

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

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.patch

*Prescreened by:*
Marc O'Morain made changes -
Attachment keyword-arity-exception-01.patch [ 18103 ]
Marc O'Morain made changes -
Description When you call a {{Keyword}} with the wrong number of arguments, the error message does not report how many arguments were passed:

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

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

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

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.patch

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

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

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

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

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-01.patch

*Prescreened by:*
Marc O'Morain made changes -
Attachment keyword-arity-exception-02.patch [ 18107 ]
Marc O'Morain made changes -
Description When you call a {{Keyword}} with the wrong number of arguments, the error message does not report how many arguments were passed:

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

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

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

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-01.patch

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

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

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

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

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-02.patch

*Prescreened by:*
Alex Miller made changes -
Approval Triaged [ 10120 ] Prescreened [ 10220 ]
Description When you call a {{Keyword}} with the wrong number of arguments, the error message does not report how many arguments were passed:

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

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

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

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-02.patch

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

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

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

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

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-02.patch

*Prescreened by:* Alex Miller
Rich Hickey made changes -
Fix Version/s Release 1.10 [ 11451 ]
Approval Prescreened [ 10220 ] Vetted [ 10003 ]
Alex Miller made changes -
Approval Vetted [ 10003 ] Incomplete [ 10006 ]
Marc O'Morain made changes -
Attachment keyword-arity-exception-03.patch [ 18291 ]
Marc O'Morain made changes -
Description When you call a {{Keyword}} with the wrong number of arguments, the error message does not report how many arguments were passed:

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

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

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

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-02.patch

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

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

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

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

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

*Prescreened by:* Alex Miller
Alex Miller made changes -
Approval Incomplete [ 10006 ] Prescreened [ 10220 ]
Alex Miller made changes -
Approval Prescreened [ 10220 ] Screened [ 10004 ]
Description When you call a {{Keyword}} with the wrong number of arguments, the error message does not report how many arguments were passed:

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

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

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

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

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

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

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

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

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
Alex Miller made changes -
Fix Version/s Release 1.10 [ 11451 ]
Fix Version/s Release 1.11 [ 11750 ]

People

Vote (1)
Watch (1)

Dates

  • Created:
    Updated: