[Proposal] Make await handle; to throw OperationCanceledException when MotionHandle.Cancel.
Akeit0 opened this issue · 2 comments
Akeit0 commented
It is odd that await handle does not throw an exception when the MotionHandle itself is canceled, even though handle.ToUniTask(cts.Token) throws an exception on CancellationTokenSource cancellation.
Akeit0 commented
public void OnMotionCanceled()
{
if (cancellationToken.IsCancellationRequested)
{
canceled = true;
}
if (canceled)
{
core.TrySetCanceled(cancellationToken);
}
else
{
core.TrySetCanceled();
// core.TrySetResult(AsyncUnit.Default);
}
}
AnnulusGames commented
It is certainly more natural to cancel the await, so I changed the behavior to do so. (#23)