Operation handles support error queries
操作句柄支持错误信息查询。
This commit is contained in:
@@ -98,19 +98,27 @@ namespace YooAsset
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 报告错误信息
|
||||
/// 按照错误级别打印错误
|
||||
/// </summary>
|
||||
public void ReportError()
|
||||
{
|
||||
YooLogger.Error($"Failed to download : {_requestURL} Error : {_lastError}");
|
||||
YooLogger.Error(GetLastError());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取最近一条错误日志
|
||||
/// 按照警告级别打印错误
|
||||
/// </summary>
|
||||
public void ReportWarning()
|
||||
{
|
||||
YooLogger.Warning(GetLastError());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取最近发生的错误信息
|
||||
/// </summary>
|
||||
public string GetLastError()
|
||||
{
|
||||
return _lastError;
|
||||
return $"Failed to download : {_requestURL} Error : {_lastError}";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -95,17 +95,21 @@ namespace YooAsset
|
||||
}
|
||||
else
|
||||
{
|
||||
ReportError();
|
||||
|
||||
string cacheFilePath = _bundleInfo.GetCacheLoadPath();
|
||||
if (File.Exists(cacheFilePath))
|
||||
File.Delete(cacheFilePath);
|
||||
|
||||
// 失败后重新尝试
|
||||
if (_failedTryAgain > 0)
|
||||
{
|
||||
ReportWarning();
|
||||
_steps = ESteps.TryAgain;
|
||||
}
|
||||
else
|
||||
{
|
||||
ReportError();
|
||||
_steps = ESteps.Failed;
|
||||
}
|
||||
}
|
||||
|
||||
// 释放下载器
|
||||
|
||||
@@ -211,13 +211,18 @@ namespace YooAsset
|
||||
if (_threadDownloader.HasError())
|
||||
{
|
||||
_lastError = _threadDownloader.Error;
|
||||
ReportError();
|
||||
|
||||
// 失败后重新尝试
|
||||
if (_failedTryAgain > 0)
|
||||
{
|
||||
ReportWarning();
|
||||
_steps = ESteps.TryAgain;
|
||||
}
|
||||
else
|
||||
{
|
||||
ReportError();
|
||||
_steps = ESteps.Failed;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -240,7 +245,7 @@ namespace YooAsset
|
||||
}
|
||||
public override void Abort()
|
||||
{
|
||||
if(IsDone() == false)
|
||||
if (IsDone() == false)
|
||||
{
|
||||
_steps = ESteps.Failed;
|
||||
_lastError = "user abort";
|
||||
|
||||
Reference in New Issue
Block a user