Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit af44d27

Browse files
committed
Moar logging
1 parent acd4d34 commit af44d27

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/GitHub.Api/Tasks/ProcessTask.cs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public void Run()
104104

105105
try
106106
{
107-
Logger.Trace($"Running '{Process.StartInfo.FileName.ToNPath().FileName} {taskName}'");
107+
Logger.Trace($"Running '{Process.StartInfo.FileName} {taskName}'");
108108

109109
Process.Start();
110110

@@ -154,9 +154,11 @@ public void Run()
154154
}
155155
}
156156
}
157-
catch (Win32Exception ex)
157+
catch (Exception ex)
158158
{
159-
var errorCode = ex.NativeErrorCode;
159+
var errorCode = -42;
160+
if (ex is Win32Exception)
161+
errorCode = ((Win32Exception)ex).NativeErrorCode;
160162

161163
StringBuilder sb = new StringBuilder();
162164
if (Process.StartInfo.Arguments.Contains("-credential"))
@@ -172,12 +174,6 @@ public void Run()
172174
}
173175
thrownException = new ProcessException(errorCode, sb.ToString(), ex);
174176
}
175-
catch (Exception ex)
176-
{
177-
thrownException = new ProcessException(Process.HasExited ? Process.ExitCode : -42,
178-
"Unknown error",
179-
ex);
180-
}
181177

182178
if (thrownException != null || errors.Count > 0)
183179
onError?.Invoke(thrownException, string.Join(Environment.NewLine, errors.ToArray()));

0 commit comments

Comments
 (0)