mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-08-27 21:34:38 -05:00
throw
This commit is contained in:
@@ -78,15 +78,17 @@ namespace UniGLTF.AltTask
|
||||
|
||||
public Awaitable(Task task)
|
||||
{
|
||||
if (task.IsFaulted)
|
||||
{
|
||||
throw task.Exception;
|
||||
}
|
||||
_task = task;
|
||||
if (_task.Exception != null)
|
||||
{
|
||||
throw _task.Exception;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsCompleted => _task.IsCompleted;
|
||||
|
||||
public Exception Exception => _task.Exception;
|
||||
|
||||
public IAwaiter GetAwaiter()
|
||||
{
|
||||
return new Awaiter(this);
|
||||
@@ -130,6 +132,10 @@ namespace UniGLTF.AltTask
|
||||
|
||||
public void GetResult()
|
||||
{
|
||||
if (m_task.Exception != null)
|
||||
{
|
||||
throw m_task.Exception;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnCompleted(Action continuation)
|
||||
|
||||
@@ -70,11 +70,15 @@ namespace UniGLTF.AltTask
|
||||
public Awaitable(Task<T> task)
|
||||
{
|
||||
_task = task;
|
||||
if (_task.Exception != null)
|
||||
{
|
||||
throw _task.Exception;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool IsCompleted => _task.IsCompleted;
|
||||
public T Result => _task.Result;
|
||||
public Exception Exception => _task.Exception;
|
||||
|
||||
public IAwaiter<T> GetAwaiter()
|
||||
{
|
||||
@@ -110,6 +114,10 @@ namespace UniGLTF.AltTask
|
||||
|
||||
public T GetResult()
|
||||
{
|
||||
if (m_task.Exception != null)
|
||||
{
|
||||
throw m_task.Exception;
|
||||
}
|
||||
return m_task.Result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user