Use InnerException when only be one

pull/486/head
hadashiA 2023-09-07 09:11:47 +09:00
parent 6fb4f2d6d2
commit 2d674999f0
1 changed files with 2 additions and 2 deletions

View File

@ -28,7 +28,7 @@ namespace Cysharp.Threading.Tasks
p.TrySetCanceled();
break;
case TaskStatus.Faulted:
p.TrySetException(x.Exception.InnerException);
p.TrySetException(x.Exception.InnerExceptions.Count == 1 ? x.Exception.InnerException : x.Exception);
break;
case TaskStatus.RanToCompletion:
p.TrySetResult(x.Result);
@ -58,7 +58,7 @@ namespace Cysharp.Threading.Tasks
p.TrySetCanceled();
break;
case TaskStatus.Faulted:
p.TrySetException(x.Exception.InnerException);
p.TrySetException(x.Exception.InnerExceptions.Count == 1 ? x.Exception.InnerException : x.Exception);
break;
case TaskStatus.RanToCompletion:
p.TrySetResult();