Improve UnityWebRequestError performance

master
neuecc 2020-06-19 16:45:55 +09:00
parent 5ed943bca2
commit c2538da1cd
1 changed files with 18 additions and 1 deletions

View File

@ -10,13 +10,30 @@ namespace Cysharp.Threading.Tasks
public UnityWebRequest UnityWebRequest { get; }
public bool IsNetworkError { get; }
public bool IsHttpError { get; }
public string Error { get; }
public string Text { get; }
string msg;
public UnityWebRequestException(UnityWebRequest unityWebRequest)
: base(unityWebRequest.error + Environment.NewLine + unityWebRequest.downloadHandler.text)
{
this.UnityWebRequest = unityWebRequest;
this.IsNetworkError = unityWebRequest.isNetworkError;
this.IsHttpError = unityWebRequest.isHttpError;
this.Error = unityWebRequest.error;
this.Text = unityWebRequest.downloadHandler.text;
}
public override string Message
{
get
{
if (msg == null)
{
msg = Error + Environment.NewLine + Text;
}
return msg;
}
}
}
}