Only print the full error message in debug mode

This commit is contained in:
Henry Mercer 2022-12-02 14:38:40 +00:00
parent e0ff272230
commit 375dacad24
3 changed files with 17 additions and 15 deletions

11
lib/upload-lib.js generated
View file

@ -346,10 +346,13 @@ function handleProcessingResultForUnsuccessfulExecution(response, status, logger
'"unsuccessful execution" error, and no other errors.'); '"unsuccessful execution" error, and no other errors.');
} }
else { else {
throw new Error(`${"Failed to upload a SARIF file for the unsuccessful execution. Code scanning status " + const shortMessage = "Failed to upload a SARIF file for the unsuccessful execution. Code scanning status " +
"information for the repository may be out of date as a result. "}${status === "failed" "information for the repository may be out of date as a result.";
? `Processing errors: ${response.data.errors}` const longMessage = shortMessage + status === "failed"
: 'Encountered no processing errors, but expected to receive an "unsuccessful execution" error.'}`); ? ` Processing errors: ${response.data.errors}`
: ' Encountered no processing errors, but expected to receive an "unsuccessful execution" error.';
logger.debug(longMessage);
throw new Error(shortMessage);
} }
} }
function validateUniqueCategory(sarif) { function validateUniqueCategory(sarif) {

File diff suppressed because one or more lines are too long

View file

@ -488,16 +488,15 @@ function handleProcessingResultForUnsuccessfulExecution(
'"unsuccessful execution" error, and no other errors.' '"unsuccessful execution" error, and no other errors.'
); );
} else { } else {
throw new Error( const shortMessage =
`${ "Failed to upload a SARIF file for the unsuccessful execution. Code scanning status " +
"Failed to upload a SARIF file for the unsuccessful execution. Code scanning status " + "information for the repository may be out of date as a result.";
"information for the repository may be out of date as a result. " const longMessage =
}${ shortMessage + status === "failed"
status === "failed" ? ` Processing errors: ${response.data.errors}`
? `Processing errors: ${response.data.errors}` : ' Encountered no processing errors, but expected to receive an "unsuccessful execution" error.';
: 'Encountered no processing errors, but expected to receive an "unsuccessful execution" error.' logger.debug(longMessage);
}` throw new Error(shortMessage);
);
} }
} }