8000 Merge pull request #3 from UiPath/feature/error_properties · UiPath/libgit2sharp@fd9e72e · GitHub
[go: up one dir, main page]

Skip to content

Commit fd9e72e

Browse files
Merge pull request #3 from UiPath/feature/error_properties
Add properties for the git error code and category on LibGit2SharpException
2 parents aa79bbd + 46f62a0 commit fd9e72e

File tree

4 files changed

+16
-2
lines changed

4 files changed

+16
-2
lines changed

LibGit2Sharp/Core/Ensure.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ private static unsafe void HandleError(int result)
143143
else
144144
{
145145
errorMessage = LaxUtf8Marshaler.FromNative(error->Message);
146+
errorCategory = error->Category;
146147
}
147148

148149
Func<string, GitErrorCode, GitErrorCategory, LibGit2SharpException> exceptionBuilder;

LibGit2Sharp/Core/GitErrorCategory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace LibGit2Sharp.Core
22
{
3-
internal enum GitErrorCategory
3+
public enum GitErrorCategory
44
{
55
Unknown = -1,
66
None,

LibGit2Sharp/Core/GitErrorCode.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace LibGit2Sharp.Core
22
{
3-
internal enum GitErrorCode
3+
public enum GitErrorCode
44
{
55
Ok = 0,
66
Error = -1,

LibGit2Sharp/LibGit2SharpException.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberD A3E1 iff line change
@@ -57,6 +57,19 @@ internal LibGit2SharpException(string message, GitErrorCode code, GitErrorCatego
5757
{
5858
Data.Add("libgit2.code", (int)code);
5959
Data.Add("libgit2.category", (int)category);
60+
61+
GitErrorCode = code;
62+
GitErrorCategory = category;
6063
}
64+
65+
/// <summary>
66+
/// The error code returned by libgit2
67+
/// </summary>
68+
public GitErrorCode GitErrorCode { get; }
69+
70+
/// <summary>
71+
/// The error category
72+
/// </summary>
73+
public GitErrorCategory GitErrorCategory { get; }
6174
}
6275
}

0 commit comments

Comments
 (0)
0