feat: reclassify InvalidSarifUploadError as a user-error when final status report is produced
This commit is contained in:
parent
72a2b1295e
commit
f21cf0bbd7
6 changed files with 28 additions and 4 deletions
|
|
@ -15,6 +15,7 @@ import {
|
|||
setupActionsVars,
|
||||
createTestConfig,
|
||||
} from "./testing-utils";
|
||||
import { InvalidSarifUploadError } from "./upload-lib";
|
||||
import { BuildMode, ConfigurationError, withTmpDir, wrapError } from "./util";
|
||||
|
||||
setupTests(test);
|
||||
|
|
@ -242,4 +243,12 @@ test("getActionStatus handling correctly various types of errors", (t) => {
|
|||
"user-error",
|
||||
"We still recognise a wrapped ConfigurationError as a user error",
|
||||
);
|
||||
|
||||
t.is(
|
||||
getActionsStatus(
|
||||
new InvalidSarifUploadError("SyntaxError: Unexpected end of JSON input"),
|
||||
),
|
||||
"user-error",
|
||||
"We recognise an InvalidSarifUploadError as a user error",
|
||||
);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import { EnvVar } from "./environment";
|
|||
import { getRef } from "./git-utils";
|
||||
import { Logger } from "./logging";
|
||||
import { getRepositoryNwo } from "./repository";
|
||||
import { InvalidSarifUploadError } from "./upload-lib";
|
||||
import {
|
||||
ConfigurationError,
|
||||
isHTTPError,
|
||||
|
|
@ -173,7 +174,14 @@ export function getActionsStatus(
|
|||
otherFailureCause?: string,
|
||||
): ActionStatus {
|
||||
if (error || otherFailureCause) {
|
||||
return error instanceof ConfigurationError ? "user-error" : "failure";
|
||||
if (
|
||||
error instanceof ConfigurationError ||
|
||||
error instanceof InvalidSarifUploadError
|
||||
) {
|
||||
return "user-error";
|
||||
}
|
||||
|
||||
return "failure";
|
||||
} else {
|
||||
return "success";
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue