-
Notifications
You must be signed in to change notification settings - Fork 36.8k
Improve error message extraction when Git hooks fail #282524
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
base: main
Are you sure you want to change the base?
Improve error message extraction when Git hooks fail #282524
Conversation
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: @lszomoruMatched files:
|
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 message extraction in the Git extension's error handling to prevent displaying misleading success/informational messages when Git hooks fail. The enhancement adds intelligent filtering to prioritize actual failure indicators over generic output.
Key changes:
- Implemented multi-stage filtering logic to identify actual error messages in Git hook failures
- Added detection patterns for failure indicators ("Failed", "exit code", "hook id")
- Added exclusion patterns for success/skip messages to prevent them from being displayed as errors
|
@microsoft-github-policy-service agree [company="OutSystems"] |
|
@microsoft-github-policy-service agree company="OutSystems" |
Extracted regex patterns into constants: Created FAILURE_PATTERNS and SUCCESS_PATTERNS arrays at the top of the default case block to eliminate duplication and improve maintainability. Used the constants throughout: All regex pattern checks now use these constants via .some(pattern => pattern.test(line)).
…thub.com/fabio-andre-rodrigues/vscode into better_error_message_when_git_hook_fails
Summary
This PR improves the error message handling in the Git extension to better extract and display meaningful error messages when Git hooks fail. Previously, the code would simply take the first line of the error output, which could result in showing informational or success messages as errors.
Address Bug Report
282523
Changes
Technical Details
The changes are in the
CommandCenterclass's error handling switch statement. The new logic:Testing