-
Notifications
You must be signed in to change notification settings - Fork 1
Add file paths to error messages #173
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
Conversation
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
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.
Pull request overview
This PR improves error messages by adding file paths to parsing, unmarshaling, and parameter expansion errors, making it easier to debug issues when processing multiple files.
- Added file paths to error messages in markdown.go for open, scan, and unmarshal operations
- Added file paths to error messages in context.go for parse and parameter expansion errors in tasks, commands, and rules
- Added test coverage to verify file paths appear in error messages
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| pkg/codingcontext/markdown/markdown.go | Added file path parameter to three error messages (open, scan, unmarshal frontmatter) for better error diagnostics |
| pkg/codingcontext/context.go | Added file path parameter to four error messages (task parse, task parameter expansion, command parameter expansion, rule parameter expansion) |
| pkg/codingcontext/markdown/markdown_test.go | Added test coverage for file path inclusion in error messages with table-driven test following project standards |
| func TestParseMarkdownFile_ErrorsIncludeFilePath(t *testing.T) { | ||
| tests := []struct { | ||
| name string | ||
| content string | ||
| want string // substring that should appear in error | ||
| }{ | ||
| { | ||
| name: "invalid YAML in frontmatter", | ||
| content: `--- | ||
| invalid: yaml: : syntax | ||
| --- | ||
| Content here`, | ||
| want: "failed to unmarshal frontmatter in file", | ||
| }, | ||
| } |
Copilot
AI
Dec 24, 2025
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 test coverage for error messages is good, but it only covers the unmarshal error case. Consider adding a test case for the scan error on line 71 of markdown.go to ensure complete coverage of all file path error messages. However, since scanner errors are rare and difficult to simulate, this is a minor suggestion.
File-related errors (parsing failures, YAML unmarshal errors, parameter expansion errors) did not indicate which file caused the issue, making debugging difficult when processing multiple files.
Changes:
Example:
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.