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.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;
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
Loading…
Reference in New Issue