Better attribute parsing error message

This commit is contained in:
Anuken
2026-02-20 15:58:03 -05:00
parent fd00f3fae3
commit 3b179315c1
2 changed files with 4 additions and 1 deletions

View File

@@ -91,6 +91,9 @@ public class ContentParser{
return Attribute.add(attr);
});
put(Attributes.class, (type, data) -> {
if(!data.isObject()){
throw new IllegalArgumentException("Attribute definitions must be objects, e.g. {heat: 10}");
}
Attributes attr = new Attributes();
for(var child : data){
Attribute value = Attribute.exists(child.name) ? Attribute.get(child.name) : Attribute.add(child.name);