Refactoring: Simplify retrieving error message

This commit is contained in:
Henry Mercer
2024-09-16 22:38:35 +02:00
parent bbd7c801a0
commit dd7307d603
54 changed files with 106 additions and 89 deletions

10
lib/debug-artifacts.js generated
View File

@@ -87,7 +87,7 @@ function tryGetSarifResultPath(config, language, logger) {
}
}
catch (e) {
logger.warning(`Failed to find SARIF results path for ${language}. Reason: ${(0, util_1.wrapError)(e).message}`);
logger.warning(`Failed to find SARIF results path for ${language}. Reason: ${(0, util_1.getErrorMessage)(e)}`);
}
return [];
}
@@ -99,13 +99,13 @@ async function tryBundleDatabase(config, language, logger) {
}
catch (e) {
logger.warning(`Failed to bundle database for ${language} using the CLI. ` +
`Falling back to a partial bundle. Reason: ${(0, util_1.wrapError)(e).message}`);
`Falling back to a partial bundle. Reason: ${(0, util_1.getErrorMessage)(e)}`);
}
}
return [await createPartialDatabaseBundle(config, language)];
}
catch (e) {
logger.warning(`Failed to bundle database for ${language}. Reason: ${(0, util_1.wrapError)(e).message}`);
logger.warning(`Failed to bundle database for ${language}. Reason: ${(0, util_1.getErrorMessage)(e)}`);
return [];
}
}
@@ -131,7 +131,7 @@ async function uploadAllAvailableDebugArtifacts(config, logger) {
await uploadDebugArtifacts(filesToUpload, config.dbLocation, config.debugArtifactName);
}
catch (e) {
logger.warning(`Failed to upload debug artifacts. Reason: ${(0, util_1.wrapError)(e).message}`);
logger.warning(`Failed to upload debug artifacts. Reason: ${(0, util_1.getErrorMessage)(e)}`);
}
}
async function uploadDebugArtifacts(toUpload, rootDir, artifactName) {
@@ -158,7 +158,7 @@ async function uploadDebugArtifacts(toUpload, rootDir, artifactName) {
}
catch (e) {
// A failure to upload debug artifacts should not fail the entire action.
core.warning(`Failed to upload debug artifacts. Reason: ${(0, util_1.wrapError)(e).message}`);
core.warning(`Failed to upload debug artifacts. Reason: ${(0, util_1.getErrorMessage)(e)}`);
}
}
/**