Exception cleanup. Code cleanup.

This commit is contained in:
2022-12-23 15:20:16 +08:00
parent ff5928b556
commit 356f4df9a9
13 changed files with 51 additions and 77 deletions

View File

@@ -1,3 +1,4 @@
using Cryville.Common;
using Cryville.Common.Pdt;
using Cryville.Crtr.Components;
using Cryville.Crtr.Event;
@@ -100,10 +101,16 @@ namespace Cryville.Crtr {
SkinProperty GetPropOp(Transform obj, SkinPropertyKey key) {
var ctype = key.Component;
var comp = (SkinComponent)obj.GetComponent(ctype);
if (comp == null) throw new InvalidOperationException("Component instance not found");
if (comp == null) throw new InvalidOperationException(string.Format(
"Trying to set property {0} but the component is not found",
IdentifierManager.SharedInstance.Retrieve(key.Name)
));
SkinProperty result;
if (!comp.Properties.TryGetValue(key.Name, out result))
throw new ArgumentException(string.Format("Property {0} not found on component", key.Name));
throw new ArgumentException(string.Format(
"Property {0} not found on component",
IdentifierManager.SharedInstance.Retrieve(key.Name)
));
return result;
}
}