Merged
Conversation
Contributor
There was a problem hiding this comment.
PR Overview
This PR refines error handling around downloading and extracting the CodeQL CLI and introduces a new error category for temporary directory issues.
- Updates error rethrowing in both JavaScript and TypeScript implementations to conditionally use a ConfigurationError.
- Adds a new error category "CouldNotCreateTempDir" in both the JS and TS CLI error modules.
Reviewed Changes
| File | Description |
|---|---|
| lib/codeql.js | Refactors error handling in the CLI setup to use a dynamic error type based on conditions. |
| src/codeql.ts | Mirrors the same error handling improvements as in lib/codeql.js. |
| lib/cli-errors.js | Introduces a new error category "CouldNotCreateTempDir" to better classify temp directory errors. |
| src/cli-errors.ts | Adds the "CouldNotCreateTempDir" enum member, aligning with the changes in the JS error module. |
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (4)
lib/codeql.js:136
- Consider using a helper function or preserving the original error (including its prototype and stack trace) when rethrowing. This can improve debuggability by retaining more context from the original error.
const ErrorClass = e instanceof util.ConfigurationError || (e instanceof Error && e.message.includes("ENOSPC")) // out of disk space
src/codeql.ts:380
- Similar to the JS version, consider preserving the original error context by wrapping or logging the actual error object when rethrowing it. Maintaining the original error's details can help with future debugging.
const ErrorClass = e instanceof util.ConfigurationError || (e instanceof Error && e.message.includes("ENOSPC")) // out of disk space
lib/cli-errors.js:113
- The new error category 'CouldNotCreateTempDir' appears clear; please ensure downstream error handling also recognizes and properly handles this category.
CliConfigErrorCategory["CouldNotCreateTempDir"] = "CouldNotCreateTempDir";
src/cli-errors.ts:122
- Ensure that the error messages or handling logic associated with 'CouldNotCreateTempDir' are consistent with its usage in the JS version.
CouldNotCreateTempDir = "CouldNotCreateTempDir",
Tip: Copilot code review supports C#, Go, Java, JavaScript, Markdown, Python, Ruby and TypeScript, with more languages coming soon. Learn more
aeisenberg
approved these changes
Feb 26, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Had an old branch on my machine that adds a couple of configuration errors.
Merge / deployment checklist