Atlassian uses cookies to improve your browsing experience, perform analytics and research, and conduct advertising. Accept all cookies to indicate that you agree to our use of cookies on your device. Atlassian cookies and tracking notice, (opens new window)
Improve error messages by using pr-str instead of str when printing objects
Description
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.
Environment
None
Attachments
2
20 Apr 2019, 08:29 PM
15 Mar 2018, 07:33 PM
Activity
Show:
Mike Fikes March 31, 2020 at 11:44 PM
0001-CLJS-1908-Wrap-vars-in-throw-message-with-pr-str-2.patch conflicts with master
Mike Fikes May 12, 2019 at 2:23 AM
0001-CLJS-1908-Wrap-vars-in-throw-message-with-pr-str-2.patch added to Patch Tender
Mike Fikes April 26, 2019 at 1:33 AM
0001-CLJS-1908-Wrap-vars-in-throw-message-with-pr-str-2.patch passes CI and Canary
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. Ifx
was wrapped withpr-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.