Skip to content
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

[BUG] Parse error gets lost, Error.captureStackTrace is not a function #1

Closed
pblanco-dekalabs opened this issue Aug 19, 2022 · 2 comments
Labels
question Further information is requested

Comments

@pblanco-dekalabs
Copy link

What / Why

The parse method does not return a meaningful error

 Error.captureStackTrace is not a function
    JSONParseError index.js:58
    parseJson index.js:105

When

  • Whenever I try to parse bad JSON.

Where

  • React-CRA app.

How

Current Behavior

  • Parsing throws TypeError: xxx is not a function

Steps to Reproduce

const info = JSON.parse('Bad Json. {"a":0}');

Expected Behavior

  • An error about the parsing problem.
@lukekarrys
Copy link
Member

Can you run npm explain json-parse-even-better-errors in your project? This library is designed to be used in Node since it uses Error.captureStackTrace which is not available in browsers.

@lukekarrys lukekarrys added the question Further information is requested label Oct 4, 2022
@lukekarrys
Copy link
Member

Closing due to age. Please reopen if this is still an issue for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants