mirror of https://github.com/Cysharp/UniTask
Account for nested aggregates by flattening
parent
2492ea60c3
commit
65922863b6
|
@ -46,9 +46,10 @@ namespace Cysharp.Threading.Tasks
|
||||||
|
|
||||||
public ExceptionHolder(Exception exception)
|
public ExceptionHolder(Exception exception)
|
||||||
{
|
{
|
||||||
if (exception is AggregateException aex && aex.InnerExceptions?.Count == 1)
|
var flattenedAggregate = (exception as AggregateException)?.Flatten();
|
||||||
|
if (flattenedAggregate?.InnerExceptions?.Count == 1)
|
||||||
{
|
{
|
||||||
this.exception = ExceptionDispatchInfo.Capture(aex.InnerExceptions[0]);
|
this.exception = ExceptionDispatchInfo.Capture(flattenedAggregate.InnerExceptions[0]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue