mirror of
https://github.com/project-redbud/FunGame-Core.git
synced 2025-04-21 03:29:36 +08:00
为TaskAwaiter传入异常参数方便处理异常
This commit is contained in:
parent
1c4e796f09
commit
e4aef07792
@ -6,6 +6,6 @@
|
||||
public Exception Exception { get; }
|
||||
|
||||
public ITaskAwaiter OnCompleted(Action action);
|
||||
public ITaskAwaiter OnError(Action action);
|
||||
public ITaskAwaiter OnError(Action<Exception> action);
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ namespace Milimoe.FunGame.Core.Library.Common.Architecture
|
||||
/// </summary>
|
||||
/// <param name="action"></param>
|
||||
/// <returns></returns>
|
||||
public TaskAwaiter OnError(Action action)
|
||||
public TaskAwaiter OnError(Action<System.Exception> action)
|
||||
{
|
||||
awaiter = awaiter.OnError(action);
|
||||
return this;
|
||||
|
@ -27,7 +27,7 @@ namespace Milimoe.FunGame.Core.Service
|
||||
public Exception Exception => _Exception;
|
||||
|
||||
private delegate void CompletedEvent();
|
||||
private delegate void ErrorEvent();
|
||||
private delegate void ErrorEvent(Exception e);
|
||||
private event CompletedEvent? Completed;
|
||||
private event ErrorEvent? Error;
|
||||
|
||||
@ -57,7 +57,7 @@ namespace Milimoe.FunGame.Core.Service
|
||||
/// </summary>
|
||||
/// <param name="action"></param>
|
||||
/// <returns></returns>
|
||||
public ITaskAwaiter OnError(Action action)
|
||||
public ITaskAwaiter OnError(Action<Exception> action)
|
||||
{
|
||||
Error += new ErrorEvent(action);
|
||||
return this;
|
||||
@ -74,7 +74,7 @@ namespace Milimoe.FunGame.Core.Service
|
||||
catch (Exception e)
|
||||
{
|
||||
_Exception = e;
|
||||
Error?.Invoke();
|
||||
Error?.Invoke(e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -89,7 +89,7 @@ namespace Milimoe.FunGame.Core.Service
|
||||
catch (Exception e)
|
||||
{
|
||||
_Exception = e;
|
||||
Error?.Invoke();
|
||||
Error?.Invoke(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user