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

+1 vote
in ClojureScript by

Many error messages from ClojureScript include the invalid argument like this:

(throw (js/Error. (str "Doesn't support name: " x)))

If {{x}} is nil, then the error message produces is {{"Doesn't support name: "}} which is a bit mystifying to debug. If {{x}} was wrapped with {{pr-str}} then the error message would be the much more understandable: {{"Doesn't support name: nil"}}.

If there's interest in this, then I can prepare a patch which wraps these kinds of errors with pr-str.

10 Answers

0 votes
by

Comment made by: dnolen

Go for it

0 votes
by

Comment made by: mfikes

I also pondered this for a bit with CLJS-2089. Seems like the right thing to do in general.

0 votes
by

Comment made by: mfikes

Patch no longer applies.

0 votes
by

Comment made by: slipset

Should apply now, I hope

0 votes
by

Comment made by: mfikes

0001-CLJS-1908-Wrap-vars-in-throw-message-with-pr-str.patch no longer applies

0 votes
by

Comment made by: slipset

0001-CLJS-1908-Wrap-vars-in-throw-message-with-pr-str-2.patch updated, should apply

0 votes
by

Comment made by: mfikes

0001-CLJS-1908-Wrap-vars-in-throw-message-with-pr-str-2.patch LGTM

0 votes
by

Comment made by: mfikes

0001-CLJS-1908-Wrap-vars-in-throw-message-with-pr-str-2.patch passes CI and Canary (/)

0 votes
by

Comment made by: mfikes

0001-CLJS-1908-Wrap-vars-in-throw-message-with-pr-str-2.patch added to Patch Tender (i)

0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJS-1908 (reported by desk@danielcompton.net)
...