-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More friendly messages for non-string #1
Conversation
After some discussion on sindresorhus/parse-json#16, I updated error handling.
Also added a bunch of test codes to increase coverage to 100%. |
sorry to ping @zkat , I'd appriciate if you could review this PR :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems reasonable enough
Merged and released as |
More friendly error messages. PR-URL: zkat/json-parse-better-errors#1 Credit: @Hoishin
More friendly error messages. PR-URL: zkat/json-parse-better-errors#1 Credit: @Hoishin
More friendly error messages. PR-URL: zkat/json-parse-better-errors#1 Credit: @Hoishin
More friendly error messages. PR-URL: zkat/json-parse-better-errors#1 Credit: @Hoishin
More friendly error messages. PR-URL: zkat/json-parse-better-errors#1 Credit: @Hoishin
(Originally opened at sindresorhus/parse-json#16)
When I passed
undefined
, the error wasFor
NaN
,Infinity
,new Set()
etc,The cause was assuming the passed value is a string, so I added type check. Throws message with the type and the value converted to string if the value is not string.