diff --git a/src/UniTask/Assets/Plugins/UniTask/Runtime/UnityWebRequestError.cs b/src/UniTask/Assets/Plugins/UniTask/Runtime/UnityWebRequestError.cs index c5fe3ff..0005e4e 100644 --- a/src/UniTask/Assets/Plugins/UniTask/Runtime/UnityWebRequestError.cs +++ b/src/UniTask/Assets/Plugins/UniTask/Runtime/UnityWebRequestError.cs @@ -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; + } } } }