Include entry name in error message

This commit is contained in:
DBotThePony 2022-11-06 12:31:03 +07:00
parent 9e9cac41ee
commit 2f0b817d5d
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -233,10 +233,10 @@ object MatterManager : SimpleJsonResourceReloadListener(GsonBuilder().setPrettyP
} }
override fun update(registry: MutableCollection<MutableEntry>, modifier: ResourceLocation) { override fun update(registry: MutableCollection<MutableEntry>, modifier: ResourceLocation) {
checkNotNull(matter) { "Missing matter value, which is required for insert action" } checkNotNull(matter) { "Missing matter value, which is required for insert action (for $modifier)" }
checkNotNull(complexity) { "Missing complexity value, which is required for insert action" } checkNotNull(complexity) { "Missing complexity value, which is required for insert action (for $modifier)" }
check(!comparePriority || priority != null) { "If compare_priority is true then priority must not be null" } check(!comparePriority || priority != null) { "If compare_priority is true then priority must not be null (for $modifier)" }
if (!checkConditions()) { if (!checkConditions()) {
return return
@ -330,8 +330,8 @@ object MatterManager : SimpleJsonResourceReloadListener(GsonBuilder().setPrettyP
return return
} }
check(matter == null) { "Delete action can't have matter value" } check(matter == null) { "Delete action can't have matter value (for $modifier)" }
check(complexity == null) { "Delete action can't have complexity value" } check(complexity == null) { "Delete action can't have complexity value (for $modifier)" }
if (key != null) { if (key != null) {
val iterator = registry.iterator() val iterator = registry.iterator()
@ -600,19 +600,19 @@ object MatterManager : SimpleJsonResourceReloadListener(GsonBuilder().setPrettyP
complexityFunctions.isNotEmpty() || complexityFunctions.isNotEmpty() ||
priorityFunctions.isNotEmpty() priorityFunctions.isNotEmpty()
)) { )) {
throw JsonParseException("Can't update existing entries without anything specified") throw JsonParseException("Can't update existing entries without anything specified (for $modifier)")
} }
if (matter != null && matterFunctions.isNotEmpty()) { if (matter != null && matterFunctions.isNotEmpty()) {
throw JsonParseException("Can't have both matter and matter functions specified at the same time") throw JsonParseException("Can't have both matter and matter functions specified at the same time (for $modifier)")
} }
if (complexity != null && complexityFunctions.isNotEmpty()) { if (complexity != null && complexityFunctions.isNotEmpty()) {
throw JsonParseException("Can't have both complexity and complexity functions specified at the same time") throw JsonParseException("Can't have both complexity and complexity functions specified at the same time (for $modifier)")
} }
if (priority != null && priorityFunctions.isNotEmpty()) { if (priority != null && priorityFunctions.isNotEmpty()) {
throw JsonParseException("Can't have both priority and priority functions specified at the same time") throw JsonParseException("Can't have both priority and priority functions specified at the same time (for $modifier)")
} }
if (!checkConditions()) { if (!checkConditions()) {