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

Commit 95449aa

Browse files
committed
Fix the error and end pattern of process task
1 parent 6d17c4b commit 95449aa

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

src/GitHub.Api/Tasks/ProcessTask.cs

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ protected override T RunWithReturn(bool success)
306306
catch (Exception ex)
307307
{
308308
if (!RaiseFaultHandlers(ex))
309-
throw ex;
309+
throw;
310310
}
311311
finally
312312
{
@@ -420,19 +420,28 @@ protected override List<T> RunWithReturn(bool success)
420420
RaiseOnStart,
421421
() =>
422422
{
423-
if (outputProcessor != null)
424-
result = outputProcessor.Result;
425-
if (result == null)
426-
result = new List<T>();
427-
428-
RaiseOnEnd(result);
429-
430-
if (Errors != null)
423+
try
431424
{
432-
OnErrorData?.Invoke(Errors);
433-
thrownException = thrownException ?? new ProcessException(this);
434-
if (!RaiseFaultHandlers(thrownException))
425+
if (outputProcessor != null)
426+
result = outputProcessor.Result;
427+
if (result == null)
428+
result = new List<T>();
429+
430+
if (Errors != null)
431+
{
432+
OnErrorData?.Invoke(Errors);
433+
thrownException = thrownException ?? new ProcessException(this);
435434
throw thrownException;
435+
}
436+
}
437+
catch (Exception ex)
438+
{
439+
if (!RaiseFaultHandlers(ex))
440+
throw;
441+
}
442+
finally
443+
{
444+
RaiseOnEnd(result);
436445
}
437446
},
438447
(ex, error) =>

0 commit comments

Comments
 (0)