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

Catch JSON.parse syntax errors #16

Merged
merged 1 commit into from
May 13, 2019
Merged

Catch JSON.parse syntax errors #16

merged 1 commit into from
May 13, 2019

Conversation

roblav96
Copy link
Contributor

@roblav96 roblav96 commented May 3, 2019

A thrown SyntaxError from JSON.parse is not inside a catch block.

Example:
SyntaxError: Unexpected end of JSON input
Will exit current node process.

A thrown `SyntaxError` from `JSON.parse` is not inside a catch block.

Example:
`SyntaxError: Unexpected end of JSON input`
Will exit current node process.
Copy link
Owner

@lukeed lukeed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, good catch~! 😉

@lukeed lukeed merged commit 6d47bc7 into lukeed:master May 13, 2019
@lukeed
Copy link
Owner

lukeed commented May 13, 2019

PS :: I thought it would be best to continue having a common Error format. By the time JSON.parse ran, the request already completed, which meant we already had all the data necessary to maintain the current Error formatting. Only the err.data will be empty – which makes sense since the data could not be parsed!

That change happened here: 3535f34

Thanks again 👍

@roblav96
Copy link
Contributor Author

Loving the consistency, great implementation my friend! =]

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

Successfully merging this pull request may close these issues.

2 participants