Improve error message extraction when Git hooks fail - #282524
Open
Fábio André Ramos Rodrigues (fabio-andre-rodrigues) wants to merge 7 commits into
Open
Conversation
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: Ladislau Szomoru (@lszomoru)Matched files:
|
Contributor
There was a problem hiding this comment.
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
Author
|
@microsoft-github-policy-service agree [company="OutSystems"] |
Author
|
@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
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.
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