mirror of https://github.com/Cysharp/UniTask
Support exception unwrapping for AsUniTask of Task.WhenAll
parent
8eac07ad24
commit
6fb4f2d6d2
|
@ -19,11 +19,14 @@ namespace NetCoreTests
|
||||||
{
|
{
|
||||||
await ThrowOrValueAsync().AsUniTask();
|
await ThrowOrValueAsync().AsUniTask();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task PropagateWhenAllException()
|
||||||
|
{
|
||||||
await Assert.ThrowsAsync<InvalidOperationException>(async () =>
|
await Assert.ThrowsAsync<InvalidOperationException>(async () =>
|
||||||
{
|
{
|
||||||
await Task.WhenAll(ThrowAsync(), ThrowAsync(), ThrowAsync());
|
await Task.WhenAll(ThrowAsync(), ThrowAsync(), ThrowAsync()).AsUniTask();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ namespace Cysharp.Threading.Tasks
|
||||||
p.TrySetCanceled();
|
p.TrySetCanceled();
|
||||||
break;
|
break;
|
||||||
case TaskStatus.Faulted:
|
case TaskStatus.Faulted:
|
||||||
p.TrySetException(x.Exception.InnerExceptions.Count == 1 ? x.Exception.InnerException : x.Exception);
|
p.TrySetException(x.Exception.InnerException);
|
||||||
break;
|
break;
|
||||||
case TaskStatus.RanToCompletion:
|
case TaskStatus.RanToCompletion:
|
||||||
p.TrySetResult(x.Result);
|
p.TrySetResult(x.Result);
|
||||||
|
@ -58,7 +58,7 @@ namespace Cysharp.Threading.Tasks
|
||||||
p.TrySetCanceled();
|
p.TrySetCanceled();
|
||||||
break;
|
break;
|
||||||
case TaskStatus.Faulted:
|
case TaskStatus.Faulted:
|
||||||
p.TrySetException(x.Exception.InnerExceptions.Count == 1 ? x.Exception.InnerException : x.Exception);
|
p.TrySetException(x.Exception.InnerException);
|
||||||
break;
|
break;
|
||||||
case TaskStatus.RanToCompletion:
|
case TaskStatus.RanToCompletion:
|
||||||
p.TrySetResult();
|
p.TrySetResult();
|
||||||
|
|
Loading…
Reference in New Issue