diff --git a/src/UniTask/Assets/Plugins/UniTask/Runtime/UnityWebRequestException.cs b/src/UniTask/Assets/Plugins/UniTask/Runtime/UnityWebRequestException.cs index df61999..6dd1168 100644 --- a/src/UniTask/Assets/Plugins/UniTask/Runtime/UnityWebRequestException.cs +++ b/src/UniTask/Assets/Plugins/UniTask/Runtime/UnityWebRequestException.cs @@ -32,6 +32,10 @@ namespace Cysharp.Threading.Tasks this.Error = unityWebRequest.error; this.ResponseCode = unityWebRequest.responseCode; this.Text = unityWebRequest.downloadHandler.text; + if (UnityWebRequest.downloadHandler != null) + { + this.Text = unityWebRequest.downloadHandler.text; + } } public override string Message @@ -40,7 +44,14 @@ namespace Cysharp.Threading.Tasks { if (msg == null) { - msg = Error + Environment.NewLine + Text; + if (Text != null) + { + msg = Error + Environment.NewLine + Text; + } + else + { + msg = Error; + } } return msg; } diff --git a/src/UniTask/Assets/Scenes/SandboxMain.cs b/src/UniTask/Assets/Scenes/SandboxMain.cs index 83a80b4..f84ced7 100644 --- a/src/UniTask/Assets/Scenes/SandboxMain.cs +++ b/src/UniTask/Assets/Scenes/SandboxMain.cs @@ -476,25 +476,9 @@ public class SandboxMain : MonoBehaviour async UniTaskVoid Start() { - var cts = new CancellationTokenSource(); - okButton.onClick.AddListener(() => - { - cts.Cancel(); - }); - - //// Nanika(); - - - //await UniTask.Yield(); - - - await MyEveryUpdate().Select(x => x).Where(x => x % 2 == 0).ForEachAsync(x => - { - UnityEngine.Debug.Log(x + ":" + Time.frameCount); - }, cts.Token); - - - // this.GetCancellationTokenOnDestroy() + var url = "http://fooooooooooooooooooooooooooooooooooo.com"; + var webRequestAsyncOperation = UnityWebRequest.Head(url).SendWebRequest(); + await webRequestAsyncOperation.ToUniTask(); //PlayerLoopInfo.Inject();