libgit2 / libgit2/libgit2sharp

Provide a machine-processable exception which is not based on strings

Open
#1,770 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
3.5k
Forks
925
PR merge metrics
No merged PRs in 30d

Description

When using LibGit2Sharp with a remote repository, sometimes errors occur. Those are throw as LibGit2SharpException. At this point these exceptions can only be distinguished from each other by the exception message.
Is there a way to get certain server responses like a 404 as HTTPStatusCode and not have to extract it from the message? For example, if the URL is incorrect (server exists, but path is not valid), a LibGit2SharpException is thrown which returns "invalid url, missing path" as a message. Here a HTTPStatusCode inside the Exception would be better suited to distinguish between different server responses and to react accordingly.

Version of LibGit2Sharp (release number or SHA1)

V0.26

Operating system(s) tested; .NET runtime tested

Windows 10; .NET 4.6

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how LibGit2SharpException is created when remote repository operations receive server errors, especially the invalid-URL example described in the issue. Determine how a machine-processable HTTP status could be exposed without relying on the message, and add coverage for 404 and invalid-path responses. Done means callers can distinguish these responses programmatically.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, git
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.