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