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

feat(json): log the filename when JSON.parse fails #417

Merged
merged 1 commit into from Jun 3, 2020

Conversation

bennypowers
Copy link
Contributor

@bennypowers bennypowers commented May 26, 2020

Rollup Plugin Name: json

This PR contains:

  • bugfix
  • feature
  • refactor
  • documentation
  • other

Are tests included?

  • yes (bugfixes and features will not be merged without tests)
  • no

Breaking Changes?

  • yes (breaking changes will not be merged unless absolutely necessary)
  • no

If yes, then include "BREAKING CHANGES:" in the first commit message body, followed by a description of what is breaking.

List any relevant issue numbers:

Description

Helpful when debugging
Sometimes in a large codebase, a single comma buried in a gigantic json file can halt the entire build. This change ensures that users will more easily be able to find and fix those errors.

@bennypowers bennypowers force-pushed the patch-1 branch 2 times, most recently from 78db740 to 0d3c00e Compare May 26, 2020 18:45
README.md Outdated Show resolved Hide resolved
@bennypowers bennypowers force-pushed the patch-1 branch 2 times, most recently from 795fbcb to 0efe962 Compare May 26, 2020 19:59
@bennypowers
Copy link
Contributor Author

This should be ready to go now

Copy link
Collaborator

@shellscape shellscape left a comment

Choose a reason for hiding this comment

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

This is good for this PR, but before we publish this change I want to utilize a custom error class and do some more maintenance on this plugin. Changing Error expectations means a major version, so it's a good time to tackle that.

} catch (err) {
const error = new Error(`Could not parse ${id}`);
error.originalError = err;
throw error;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I sat on this for a while and I'm glad that I did. I'd like to see this use this.warn rather than throwing the error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

Copy link
Collaborator

@shellscape shellscape left a comment

Choose a reason for hiding this comment

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

Helpful when debugging
Sometimes in a large codebase, a single comma buried in a gigantic json file can halt the entire build. This change ensures that users will more easily be able to find and fix those errors.
@shellscape
Copy link
Collaborator

thanks!

@shellscape shellscape merged commit 28f9869 into rollup:master Jun 3, 2020
@bennypowers bennypowers deleted the patch-1 branch June 4, 2020 07:07
LarsDenBakker pushed a commit to LarsDenBakker/plugins that referenced this pull request Sep 12, 2020
Helpful when debugging
Sometimes in a large codebase, a single comma buried in a gigantic json file can halt the entire build. This change ensures that users will more easily be able to find and fix those errors.
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.

None yet

3 participants