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

Handle errors from Yarn Berry more gracefully #301

Closed
sargunv opened this issue Jan 9, 2023 · 2 comments
Closed

Handle errors from Yarn Berry more gracefully #301

sargunv opened this issue Jan 9, 2023 · 2 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@sargunv
Copy link
Contributor

sargunv commented Jan 9, 2023

Currently, if yarn npm audit has some error (other than detected vulns), audit-ci with fail with an error like this:

Uncaught Error: Invalid JSON (Unexpected "I" at position 0 in state STOP)

Instead, audit-ci's thrown error message should probably include some info about the error Yarn reported.

I ran into this in #298 , and also when trying to bump the tested Yarn version in PR #300 (CI link here)

@quinnturner
Copy link
Member

I am pretty sure this is the case for all package managers. Since every package manager implementation attempts to JSON.parse, we can probably use consistent behaviour.

Perhaps we just wrap all JSON.parse for all package managers in a try/catch and rethrow the error to include the response itself?

@quinnturner quinnturner added bug Something isn't working good first issue Good for newcomers labels Jan 9, 2023
quinnturner added a commit to quinnturner/audit-ci that referenced this issue Jan 13, 2023
quinnturner added a commit to quinnturner/audit-ci that referenced this issue Jan 13, 2023
Signed-off-by: Quinn Turner <quinnturnertech@gmail.com>
quinnturner added a commit to quinnturner/audit-ci that referenced this issue Jan 13, 2023
Signed-off-by: Quinn Turner <quinnturnertech@gmail.com>
@quinnturner
Copy link
Member

Closed with #306, released in v6.6.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants