Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Do not use LibGit2SharpException overload for unknown message #2163

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

Open
zentron wants to merge 1 commit into libgit2:master
base: master
Choose a base branch
Loading
from OctopusDeploy:robe/safe-error

Conversation

@zentron
Copy link
Contributor

@zentron zentron commented Jul 19, 2025

Background

The LibGit2SharpException class has a constructor overload that takes two parameters and attempts to call String.Format to convert the values into a single string.

Unfortunately if the provided message contains text between curly braces then the string.format throws an exception.

Related PR OctopusDeploy#10

Result

Since this message could have any value, it seems risky to assume that the provided string will have a {0} that will accept the GitErrorCategory as a replacement value. In fact it seems rather unlikely that this would typically apply at all. As a result this handler would ignore the error category in the best case, or throw an exception in the worst case.

Alternative

I'd also be happy to ignore the category entirely since its likely that it is of type GitErrorCategory.Unknown anyway

Alternative snippet

exceptionBuilder = (m, c) => new LibGit2SharpException(m);

Copy link
Contributor Author

zentron commented Jul 19, 2025

@bording this is related to a closed issue #2159

@zentron zentron deleted the robe/safe-error branch August 19, 2025 02:13
@zentron zentron restored the robe/safe-error branch August 19, 2025 02:13
@zentron zentron reopened this Aug 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /