libgit2sharp icon indicating copy to clipboard operation
libgit2sharp copied to clipboard

Most exceptions have the same type of LibGit2SharpException

Open thealifaisal opened this issue 3 years ago • 1 comments

Most exceptions have the same type of LibGit2SharpException, which makes it difficult to filter specific exceptions and throw our own exception with some custom message. One example is below:

Reproduction steps

When we provide incorrect credentials, it gives an error message "Too many authentication replays" with an exception type of LibGit2SharpException. Because of this, we cannot identify exception based on its type and provide a more user friendly exception.

Version of LibGit2Sharp (release number or SHA1)

0.27.0-preview-0158

Operating system(s) tested; .NET runtime tested

OS: Windows 10 .NET runtime: .NET 6.0

thealifaisal avatar Jan 01 '22 13:01 thealifaisal

In this particular example, you should return an error from your credential handler. You're seeing the "last chance" error message when libgit2 had prevented infinite loops of credential failures.

ethomson avatar Jan 01 '22 15:01 ethomson