File tree Expand file tree Collapse file tree 2 files changed +25
-4
lines changed
Assets/Plugins/CandyCoded.GitStatus/Scripts/CustomEditor Expand file tree Collapse file tree 2 files changed +25
-4
lines changed Original file line number Diff line number Diff line change 1
1
// Copyright (c) Scott Doxey. All Rights Reserved. Licensed under the MIT License. See LICENSE in the project root for license information.
2
2
3
3
#if UNITY_EDITOR
4
+ using System ;
4
5
using System . Collections . Generic ;
5
6
using System . Diagnostics ;
6
7
using System . Threading . Tasks ;
7
- using Debug = UnityEngine . Debug ;
8
8
9
9
namespace CandyCoded . GitStatus
10
10
{
@@ -93,7 +93,7 @@ public static async Task DiscardChanges(string path)
93
93
if (process?.StandardError.ReadLine() is string line && line.StartsWith(" error: pathspec") )
94
94
{
95
95
96
- Debug . LogError ( "File not tracked by git." ) ;
96
+ throw new Exception ( "File not tracked by git." ) ;
97
97
98
98
}
99
99
Original file line number Diff line number Diff line change @@ -25,7 +25,18 @@ private static string GetSelectedPath()
25
25
private static async void DiscardChanges ( )
26
26
{
27
27
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
+ }
29
40
30
41
}
31
42
@@ -49,8 +60,18 @@ private static async void DiscardAllChanges()
49
60
"Yes" ,
50
61
"Cancel" ) )
51
62
{
63
+ try
64
+ {
52
65
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
+ }
54
75
55
76
}
56
77
You can’t perform that action at this time.
0 commit comments