Skip to content

Commit

Permalink
Improving handling of uploadFailedSarifResult -> [Object object]
Browse files Browse the repository at this point in the history
  • Loading branch information
jsoref committed May 23, 2023
1 parent b42c6f2 commit 948803c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
9 changes: 8 additions & 1 deletion lib/init-action-post-helper.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/init-action-post-helper.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion src/init-action-post-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,15 @@ export async function run(
process.env["CODEQL_ACTION_EXPECT_UPLOAD_FAILED_SARIF"] === "true" &&
!uploadFailedSarifResult.raw_upload_size_bytes
) {
let error: string
if (uploadFailedSarifResult instanceof Error) {
error = (uploadFailedSarifResult as Error).toString();
} else {
error = JSON.stringify(uploadFailedSarifResult)
}
throw new Error(
"Expected to upload a failed SARIF file for this CodeQL code scanning run, " +
`but the result was instead ${uploadFailedSarifResult}.`
`but the result was instead ${error}.`
);
}

Expand Down

0 comments on commit 948803c

Please sign in to comment.