Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Don't exposes libgit2 error code/class directly

  • Loading branch information...
commit 08374d78c3f68cfaa6bcfd348e74ae8a15b7cd3b 1 parent 5f61f26
@tclem authored
Showing with 6 additions and 14 deletions.
  1. +6 −14 LibGit2Sharp/LibGit2SharpException.cs
View
20 LibGit2Sharp/LibGit2SharpException.cs
@@ -42,19 +42,11 @@ public LibGit2Exception(string message, Exception innerException)
/// </summary>
public class LibGit2SharpException : Exception
{
+ readonly GitErrorCode code;
+ readonly GitErrorCategory category;
readonly bool isLibraryError;
/// <summary>
- /// The error code originally returned by libgit2.
- /// </summary>
- public GitErrorCode Code { get; private set; }
-
- /// <summary>
- /// The category of error raised by libgit2.
- /// </summary>
- public GitErrorCategory Category { get; private set; }
-
- /// <summary>
/// Initializes a new instance of the <see cref = "LibGit2SharpException" /> class.
/// </summary>
public LibGit2SharpException()
@@ -66,8 +58,8 @@ public LibGit2SharpException()
/// </summary>
public LibGit2SharpException(GitErrorCode code, GitErrorCategory category, string message) : base(message)
{
- Code = code;
- Category = category;
+ Data["libgit2.code"] = this.code = code;
+ Data["libgit2.class"] = this.category = category;
isLibraryError = true;
}
@@ -94,8 +86,8 @@ public override string ToString()
{
return isLibraryError
? String.Format(CultureInfo.InvariantCulture, "An error was raised by libgit2. Class = {0} ({1}).{2}{3}",
- Category,
- Code,
+ category,
+ code,
Environment.NewLine,
Message)
: base.ToString();
Please sign in to comment.
Something went wrong with that request. Please try again.