完善报错信息
This commit is contained in:
@@ -66,10 +66,10 @@ namespace Spine
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
throw new KeyNotFoundException($"Unrecognized skel suffix '{skelPath}'");
|
||||
throw new KeyNotFoundException($"Unrecognized skel file suffix");
|
||||
}
|
||||
}
|
||||
else if (!File.Exists(atlasPath)) throw new FileNotFoundException($"{nameof(atlasPath)} not found", skelPath);
|
||||
else if (!File.Exists(atlasPath)) throw new FileNotFoundException($"{nameof(atlasPath)} not found", atlasPath);
|
||||
AtlasPath = Path.GetFullPath(atlasPath);
|
||||
|
||||
// 自动检测版本, 可能会抛出异常
|
||||
@@ -105,14 +105,21 @@ namespace Spine
|
||||
|
||||
// 依然加载不成功就只能报错
|
||||
if (_data is null || Version is null)
|
||||
throw new InvalidDataException($"Failed to load spine by existed versions: '{skelPath}', '{atlasPath}'");
|
||||
throw new InvalidDataException($"Failed to load spine by existed versions");
|
||||
}
|
||||
else
|
||||
{
|
||||
// 根据版本实例化对象
|
||||
Version = version;
|
||||
try
|
||||
{
|
||||
_data = SpineObjectData.New(Version, skelPath, atlasPath, textureLoader);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw new InvalidDataException($"Failed to load spine with version '{version}'");
|
||||
}
|
||||
}
|
||||
|
||||
// 创建状态实例
|
||||
_skeleton = _data.CreateSkeleton();
|
||||
|
||||
Reference in New Issue
Block a user