Skip to content
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

Make git helpers throw on error #193

Closed
wants to merge 1 commit into from

Conversation

ecraig12345
Copy link
Member

@ecraig12345 ecraig12345 commented Sep 21, 2022

Previously, a lot of the git helpers silently swallowed if the git command exited non-zero, which tended to hide some pretty severe bugs in consuming packages (such as beachball, see microsoft/beachball#780).

This PR updates almost all of the git helpers to explicitly throw errors if the git command exits non-zero. I think this approach is preferable because it likely indicates invalid input to the command or an invalid repo state, and either of those is something that should be explicitly surfaced (so it can be fixed) rather than hidden.

I considered adding a flag to each helper that determines whether to throw, but I think in almost all cases, throwing by default is preferable. If anyone has a use case for needing one of the helpers not to throw (which can't be covered by try/catch on the consumer end), they can open an issue.

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.

None yet

1 participant