diff --git a/Runtime/Utility/Utility.Http.cs b/Runtime/Utility/Utility.Http.cs index cd8aa07..e1a4b8f 100644 --- a/Runtime/Utility/Utility.Http.cs +++ b/Runtime/Utility/Utility.Http.cs @@ -86,9 +86,9 @@ namespace AlicizaX return request.downloadHandler.text; } - catch (OperationCanceledException) when (token.IsCancellationRequested) + catch (UnityWebRequestException e) { - Log.Error($"请求超时:{url}"); + HandleRequestError(request, url); return string.Empty; } } @@ -98,16 +98,16 @@ namespace AlicizaX switch (request.result) { case UnityWebRequest.Result.ConnectionError: - Log.Error($"无法访问地址:{url}"); + throw new GameFrameworkException($"无法访问地址:{url}"); break; case UnityWebRequest.Result.ProtocolError: - Log.Error($"HTTP协议错误 ({request.responseCode}):{url}\n{request.error}"); + throw new GameFrameworkException($"HTTP协议错误 ({request.responseCode}):{url}\n{request.error}"); break; case UnityWebRequest.Result.DataProcessingError: - Log.Error($"数据处理错误:{url}\n{request.error}"); + throw new GameFrameworkException($"数据处理错误:{url}\n{request.error}"); break; default: - Log.Error($"未知网络错误:{url}\n{request.error}"); + throw new GameFrameworkException($"未知网络错误:{url}\n{request.error}"); break; } }