diff --git a/actions/setup/js/close_entity_helpers.cjs b/actions/setup/js/close_entity_helpers.cjs index 82bdce944b8..df3b71f8ec5 100644 --- a/actions/setup/js/close_entity_helpers.cjs +++ b/actions/setup/js/close_entity_helpers.cjs @@ -11,6 +11,7 @@ const { buildWorkflowRunUrl } = require("./workflow_metadata_helpers.cjs"); const { isStagedMode } = require("./safe_output_helpers.cjs"); const { logStagedPreviewInfo } = require("./staged_preview.cjs"); const { validateTargetRepo, resolveTargetRepoConfig } = require("./repo_helpers.cjs"); +const { ERR_API } = require("./error_codes.cjs"); /** * @typedef {'issue' | 'pull_request'} EntityType @@ -401,7 +402,7 @@ function createCloseEntityHandler(config, entityConfig, callbacks, githubClient) ); // commentPosted stays false; close operation continues } else { - throw commentError; + throw new Error(`${ERR_API}: Failed to add comment to ${entityConfig.displayName} #${entityNumber}: ${errorMsg}`, { cause: commentError }); } } diff --git a/actions/setup/js/generate_safe_outputs_tools.cjs b/actions/setup/js/generate_safe_outputs_tools.cjs index e26861190de..25f5d39d382 100644 --- a/actions/setup/js/generate_safe_outputs_tools.cjs +++ b/actions/setup/js/generate_safe_outputs_tools.cjs @@ -28,6 +28,7 @@ const fs = require("fs"); const path = require("path"); +const { ERR_CONFIG } = require("./error_codes.cjs"); async function main() { const toolsSourcePath = process.env.GH_AW_SAFE_OUTPUTS_TOOLS_SOURCE_PATH || `${process.env.RUNNER_TEMP}/gh-aw/actions/safe_outputs_tools.json`; @@ -46,7 +47,7 @@ async function main() { // Load all source tools from the actions folder if (!fs.existsSync(toolsSourcePath)) { - const msg = `Error: Source tools file not found at: ${toolsSourcePath}`; + const msg = `${ERR_CONFIG}: Source tools file not found at: ${toolsSourcePath}`; console.error(msg); throw new Error(msg); } @@ -55,7 +56,7 @@ async function main() { // Load config to determine which tools are enabled if (!fs.existsSync(configPath)) { - const msg = `Error: Config file not found at: ${configPath}`; + const msg = `${ERR_CONFIG}: Config file not found at: ${configPath}`; console.error(msg); throw new Error(msg); }