Skip to content

Comments

refactor(index): surface cause on enoent#547

Open
Fdawgs wants to merge 1 commit intomainfrom
refactor/cause
Open

refactor(index): surface cause on enoent#547
Fdawgs wants to merge 1 commit intomainfrom
refactor/cause

Conversation

@Fdawgs
Copy link
Owner

@Fdawgs Fdawgs commented Feb 24, 2026

Assists in debugging.

TODO: add unit test

Checklist

Copilot AI review requested due to automatic review settings February 24, 2026 16:32
Copy link

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.

Pull request overview

This PR improves error debugging by preserving the original filesystem error when a file is not found. When an ENOENT error occurs during file opening, the new code wraps it in a "File missing" error with the original error stored in the cause property, making it easier to debug file access issues.

Changes:

  • Added error cause chaining to preserve the original ENOENT error when throwing "File missing" errors

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

throw err;
}
throw new Error("File missing");
throw new Error("File missing", { cause: err });
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

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

The test coverage for this change is missing. The existing test at line 385-392 in test/index.test.js only verifies that the error message is "File missing", but doesn't check that the cause property is set correctly with the original ENOENT error. Since the package.json specifies 100% coverage requirements and the PR description mentions "TODO: add unit test", a test should be added to verify the cause property contains the original filesystem error.

Copilot uses AI. Check for mistakes.
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.

1 participant