Clojure

better error message when passing non-seq to seq

Details

  • Type: Enhancement Enhancement
  • Status: Reopened Reopened
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Patch:
    Code
  • Approval:
    Vetted

Description

Design discussion here.

This patch improves Clojure's error message for a single common error: passing a non-seq where a seq is neede. More importantly, it is intended as a prototype for other similar improvements in the future.

Error message before:

(cons 1 2)
=> IllegalArgumentException Don't know how to create ISeq from: java.lang.Long

Error message after:

user=> (cons 1 2)
ExceptionInfo Don't know how to create ISeq from: java.lang.Long
user=> (ex-data *e)
{:instance 2}

Patch: better-error-message-for-seq.patch
NOTE: This patch was reverted as it affected the inlining of RT.seqFrom().

Activity

Stuart Halloway made changes -
Field Original Value New Value
Description This patch improves Clojure's error message for a single common error: passing a non-seq where a seq is neede. More importantly, it is intended as a prototype for other similar improvements in the future.

Error message before:

{noformat}
(cons 1 2)
=> IllegalArgumentException Don't know how to create ISeq from: java.lang.Long
{noformat}

Error message after:

{noformat}
user=> (cons 1 2)
ExceptionInfo Don't know how to create ISeq from: java.lang.Long
user=> (ex-data *e)
{:instance 2}
{noformat}
Design discussion [here|http://dev.clojure.org/display/design/Better+Error+Messages].

This patch improves Clojure's error message for a single common error: passing a non-seq where a seq is neede. More importantly, it is intended as a prototype for other similar improvements in the future.

Error message before:

{noformat}
(cons 1 2)
=> IllegalArgumentException Don't know how to create ISeq from: java.lang.Long
{noformat}

Error message after:

{noformat}
user=> (cons 1 2)
ExceptionInfo Don't know how to create ISeq from: java.lang.Long
user=> (ex-data *e)
{:instance 2}
{noformat}
Stuart Halloway made changes -
Approval Vetted [ 10003 ] Screened [ 10004 ]
Rich Hickey made changes -
Fix Version/s Release 1.5 [ 10150 ]
Rich Hickey made changes -
Approval Screened [ 10004 ] Ok [ 10007 ]
Fix Version/s Release 1.6 [ 10157 ]
Stuart Halloway made changes -
Resolution Completed [ 1 ]
Status Open [ 1 ] Closed [ 6 ]
Alex Miller made changes -
Approval Ok [ 10007 ] Incomplete [ 10006 ]
Status Closed [ 6 ] Reopened [ 4 ]
Resolution Completed [ 1 ]
Alex Miller made changes -
Approval Incomplete [ 10006 ] Vetted [ 10003 ]
Fix Version/s Release 1.6 [ 10157 ]
Alex Miller made changes -
Description Design discussion [here|http://dev.clojure.org/display/design/Better+Error+Messages].

This patch improves Clojure's error message for a single common error: passing a non-seq where a seq is neede. More importantly, it is intended as a prototype for other similar improvements in the future.

Error message before:

{noformat}
(cons 1 2)
=> IllegalArgumentException Don't know how to create ISeq from: java.lang.Long
{noformat}

Error message after:

{noformat}
user=> (cons 1 2)
ExceptionInfo Don't know how to create ISeq from: java.lang.Long
user=> (ex-data *e)
{:instance 2}
{noformat}
Design discussion [here|http://dev.clojure.org/display/design/Better+Error+Messages].

This patch improves Clojure's error message for a single common error: passing a non-seq where a seq is neede. More importantly, it is intended as a prototype for other similar improvements in the future.

Error message before:

{noformat}
(cons 1 2)
=> IllegalArgumentException Don't know how to create ISeq from: java.lang.Long
{noformat}

Error message after:

{noformat}
user=> (cons 1 2)
ExceptionInfo Don't know how to create ISeq from: java.lang.Long
user=> (ex-data *e)
{:instance 2}
{noformat}

NOTE: This patch was reverted as it affected the inlining of RT.seqFrom().
Alex Miller made changes -
Description Design discussion [here|http://dev.clojure.org/display/design/Better+Error+Messages].

This patch improves Clojure's error message for a single common error: passing a non-seq where a seq is neede. More importantly, it is intended as a prototype for other similar improvements in the future.

Error message before:

{noformat}
(cons 1 2)
=> IllegalArgumentException Don't know how to create ISeq from: java.lang.Long
{noformat}

Error message after:

{noformat}
user=> (cons 1 2)
ExceptionInfo Don't know how to create ISeq from: java.lang.Long
user=> (ex-data *e)
{:instance 2}
{noformat}

NOTE: This patch was reverted as it affected the inlining of RT.seqFrom().
Design discussion [here|http://dev.clojure.org/display/design/Better+Error+Messages].

This patch improves Clojure's error message for a single common error: passing a non-seq where a seq is neede. More importantly, it is intended as a prototype for other similar improvements in the future.

Error message before:

{noformat}
(cons 1 2)
=> IllegalArgumentException Don't know how to create ISeq from: java.lang.Long
{noformat}

Error message after:

{noformat}
user=> (cons 1 2)
ExceptionInfo Don't know how to create ISeq from: java.lang.Long
user=> (ex-data *e)
{:instance 2}
{noformat}

*Patch:* better-error-message-for-seq.patch
NOTE: This patch was reverted as it affected the inlining of RT.seqFrom().

People

Vote (1)
Watch (3)

Dates

  • Created:
    Updated: