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

Uncaught exception thrown by parsePackageJson function #12

Open
GThurler opened this issue May 9, 2018 · 1 comment
Open

Uncaught exception thrown by parsePackageJson function #12

GThurler opened this issue May 9, 2018 · 1 comment

Comments

@GThurler
Copy link

GThurler commented May 9, 2018

Hi there, great work with this module.

I've noticed using it that my application was crashing whenever I would check for updates on a branch that had an outdated package.json without the "auto-updater" field, and after some debugging found out there was an uncaught exception coming from your module, from the parsePackageJson function, in line 286.

if (!data['auto-updater']) {
    this.error('Invalid package.json. No auto-updater field', 'json.error');
    throw 'error';
}

The this.error call correctly emits the error event and prints the appropriate message, but the exception isn't handled anywhere and ends up crashing the application. Since all calls are asynchronous I can't really catch it from my application anywhere (at least from what I know).

Since there is a working error callback I don't particularly see a need to throw an exception, so I figured I'd ask if there's any deeper meaning or reason for it before submitting a PR removing the throw statement.

@juampi92
Copy link
Owner

juampi92 commented May 9, 2018

Yes! Submit the PR. Thanks for that test case :)

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

No branches or pull requests

2 participants