-
Notifications
You must be signed in to change notification settings - Fork 340
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
Classify third-party upload SyntaxError
s as configuration errors
#2171
Conversation
This describes what we are trying to do more accurately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. As a bonus, we could produce a slightly better error message, e.g. "Could not upload <path>
as it is not a valid JSON file."
Ah.. I think we are already attempting to catch this error, but it's not happening in the right place. Let me try to fix. |
Ok, I think this should do it with the appropriate error wrapping (see updated PR body)! |
src/upload-lib.ts
Outdated
)}`, | ||
); | ||
} | ||
} catch (e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: this now wraps quite a lot of code, for safety, consider wrapping just the JSON.parse
call, or catching just SyntaxError
s.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right! I changed it to wrap just the JSON.parse
😄
273f564
to
62712e9
Compare
We frequently see
SyntaxError
s from the upload action that are currently classified as failures. We were previously catching this error in thecountResultsInSarif
method, but this method runs aftervalidateSarifFileSchema
, which would have thrown aSyntaxError
before we're able to throw it as anInvalidRequestError
.This change moves the error catching to
validateSarifFileSchema
so that we will appropriately classify it as anInvalidRequestError
.Merge / deployment checklist