perf : 异常处理替换为YOO的异常类

This commit is contained in:
何冠峰
2025-12-05 15:45:04 +08:00
parent 5da8c6baf8
commit e5d0a856a5
27 changed files with 243 additions and 74 deletions
@@ -499,7 +499,7 @@ namespace YooAsset
{
if (_records.ContainsKey(bundle.BundleGUID))
{
throw new Exception("Should never get here !");
throw new YooInternalException();
}
string infoFilePath = GetBundleInfoFilePath(bundle);
@@ -521,9 +521,9 @@ namespace YooAsset
// 写入文件信息
WriteBundleInfoFile(infoFilePath, bundle.FileCRC, bundle.FileSize);
}
catch (Exception e)
catch (Exception ex)
{
YooLogger.Error($"Failed to write cache file ! {e.Message}");
YooLogger.Error($"Failed to write cache file ! {ex.Message}");
return false;
}
@@ -37,9 +37,9 @@ namespace YooAsset
return false;
}
}
catch (Exception e)
catch (Exception ex)
{
YooLogger.Error($"Failed to delete cache file ! {e.Message}");
YooLogger.Error($"Failed to delete cache file ! {ex.Message}");
return false;
}
}
@@ -33,9 +33,9 @@ namespace YooAsset
{
Directory.Delete(FileRootPath, true);
}
catch (System.Exception e)
catch (System.Exception ex)
{
YooLogger.Warning($"Failed to delete cache bundle folder : {e}");
YooLogger.Warning($"Failed to delete cache bundle folder : {ex}");
}
}
}
@@ -320,11 +320,11 @@ namespace YooAsset
File.Move(recordFileElement.DataFilePath, filePath);
_steps = ESteps.LoadCacheRawBundle;
}
catch (Exception e)
catch (Exception ex)
{
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
Error = $"Faild rename raw data file : {e.Message}";
Error = $"Faild rename raw data file : {ex.Message}";
}
}
else