Skip to content

Conversation

henrymercer
Copy link
Contributor

Had an old branch on my machine that adds a couple of configuration errors.

Merge / deployment checklist

  • Confirm this change is backwards compatible with existing workflows.
  • Confirm the readme has been updated if necessary.
  • Confirm the changelog has been updated if necessary.

@Copilot Copilot AI review requested due to automatic review settings February 26, 2025 16:54
@henrymercer henrymercer requested a review from a team as a code owner February 26, 2025 16:54
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@henrymercer henrymercer merged commit 2db5b5a into main Mar 3, 2025
270 checks passed
@henrymercer henrymercer deleted the henrymercer/more-config-errors branch March 3, 2025 12:21
@github-actions github-actions bot mentioned this pull request Mar 7, 2025
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants