More friendly messages for non-string#1
Merged
zkat merged 4 commits intozkat:latestfrom Mar 30, 2018
Merged
Conversation
Contributor
Author
|
After some discussion on sindresorhus/parse-json#16, I updated error handling.
Also added a bunch of test codes to increase coverage to 100%. |
Contributor
Author
|
sorry to ping @zkat , I'd appriciate if you could review this PR :) |
Owner
|
Merged and released as |
iarna
added a commit
to npm/npm
that referenced
this pull request
Apr 9, 2018
More friendly error messages. PR-URL: zkat/json-parse-better-errors#1 Credit: @Hoishin
iarna
added a commit
to npm/npm
that referenced
this pull request
Apr 10, 2018
More friendly error messages. PR-URL: zkat/json-parse-better-errors#1 Credit: @Hoishin
iarna
added a commit
to npm/npm
that referenced
this pull request
Apr 10, 2018
More friendly error messages. PR-URL: zkat/json-parse-better-errors#1 Credit: @Hoishin
iarna
added a commit
to npm/npm
that referenced
this pull request
Apr 11, 2018
More friendly error messages. PR-URL: zkat/json-parse-better-errors#1 Credit: @Hoishin
iarna
added a commit
to npm/npm
that referenced
this pull request
Apr 11, 2018
More friendly error messages. PR-URL: zkat/json-parse-better-errors#1 Credit: @Hoishin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(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.