From d523bac4f54abc5bca38a4d07596bbacb6f67f41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=80=9D=E6=B5=B7?= <1464576565@qq.com> Date: Sun, 27 Apr 2025 14:25:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Runtime/Utility/Utility.Http.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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; } }