-
Notifications
You must be signed in to change notification settings - Fork 369
fix(USE-001): add standardized ERR_* error codes to two non-conformant handlers #26315
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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); | ||
|
Comment on lines
49
to
52
|
||
| } | ||
|
|
@@ -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); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new wrapped throw (with
${ERR_API}: ...and{ cause: commentError }) isn’t covered by tests. Since this file already has a Vitest suite, add a unit test that forcescallbacks.addCommentto reject whencontinueOnCommentErroris false and assert the returned error message includes theERR_API:prefix (and optionally that the thrown Error has the expectedcause).