Skip to content

Commit 0e99b8c

Browse files
committed
Display alert if there is an error discarding changes.
1 parent 11c8e73 commit 0e99b8c

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

Assets/Plugins/CandyCoded.GitStatus/Scripts/CustomEditor/GitMenuItems.cs

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,18 @@ private static string GetSelectedPath()
2525
private static async void DiscardChanges()
2626
{
2727

28-
await Git.DiscardChanges(GetSelectedPath());
28+
try
29+
{
30+
31+
await Git.DiscardChanges(GetSelectedPath());
32+
33+
}
34+
catch (Exception error)
35+
{
36+
37+
EditorUtility.DisplayDialog("Error", error.Message, "Ok");
38+
39+
}
2940

3041
}
3142

@@ -49,8 +60,18 @@ private static async void DiscardAllChanges()
4960
"Yes",
5061
"Cancel"))
5162
{
63+
try
64+
{
5265

53-
await Git.DiscardChanges(GetSelectedPath());
66+
await Git.DiscardChanges(GetSelectedPath());
67+
68+
}
69+
catch (Exception error)
70+
{
71+
72+
EditorUtility.DisplayDialog("Error", error.Message, "Ok");
73+
74+
}
5475

5576
}
5677

0 commit comments

Comments
 (0)