mirror of https://github.com/Cysharp/UniTask
NRE on head request with invalid url #108
parent
32f24cf8f8
commit
6dd2b464a3
|
@ -32,6 +32,10 @@ namespace Cysharp.Threading.Tasks
|
||||||
this.Error = unityWebRequest.error;
|
this.Error = unityWebRequest.error;
|
||||||
this.ResponseCode = unityWebRequest.responseCode;
|
this.ResponseCode = unityWebRequest.responseCode;
|
||||||
this.Text = unityWebRequest.downloadHandler.text;
|
this.Text = unityWebRequest.downloadHandler.text;
|
||||||
|
if (UnityWebRequest.downloadHandler != null)
|
||||||
|
{
|
||||||
|
this.Text = unityWebRequest.downloadHandler.text;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string Message
|
public override string Message
|
||||||
|
@ -39,9 +43,16 @@ namespace Cysharp.Threading.Tasks
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (msg == null)
|
if (msg == null)
|
||||||
|
{
|
||||||
|
if (Text != null)
|
||||||
{
|
{
|
||||||
msg = Error + Environment.NewLine + Text;
|
msg = Error + Environment.NewLine + Text;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
msg = Error;
|
||||||
|
}
|
||||||
|
}
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -476,25 +476,9 @@ public class SandboxMain : MonoBehaviour
|
||||||
|
|
||||||
async UniTaskVoid Start()
|
async UniTaskVoid Start()
|
||||||
{
|
{
|
||||||
var cts = new CancellationTokenSource();
|
var url = "http://fooooooooooooooooooooooooooooooooooo.com";
|
||||||
okButton.onClick.AddListener(() =>
|
var webRequestAsyncOperation = UnityWebRequest.Head(url).SendWebRequest();
|
||||||
{
|
await webRequestAsyncOperation.ToUniTask();
|
||||||
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()
|
|
||||||
|
|
||||||
//PlayerLoopInfo.Inject();
|
//PlayerLoopInfo.Inject();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue