Skip to content

Commit 948803c

Browse files
committed
Improving handling of uploadFailedSarifResult -> [Object object]
1 parent b42c6f2 commit 948803c

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

lib/init-action-post-helper.js

+8-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/init-action-post-helper.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/init-action-post-helper.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,15 @@ export async function run(
171171
process.env["CODEQL_ACTION_EXPECT_UPLOAD_FAILED_SARIF"] === "true" &&
172172
!uploadFailedSarifResult.raw_upload_size_bytes
173173
) {
174+
let error: string
175+
if (uploadFailedSarifResult instanceof Error) {
176+
error = (uploadFailedSarifResult as Error).toString();
177+
} else {
178+
error = JSON.stringify(uploadFailedSarifResult)
179+
}
174180
throw new Error(
175181
"Expected to upload a failed SARIF file for this CodeQL code scanning run, " +
176-
`but the result was instead ${uploadFailedSarifResult}.`
182+
`but the result was instead ${error}.`
177183
);
178184
}
179185

0 commit comments

Comments
 (0)