aboutsummaryrefslogtreecommitdiff
path: root/common/src/main/java/dev/isxander/yacl3/config/v2
diff options
context:
space:
mode:
authorisXander <xander@isxander.dev>2023-08-15 17:33:16 +0100
committerisXander <xander@isxander.dev>2023-08-15 17:33:16 +0100
commitd1ef9c7286dbb241bf3fc072065edef3b20421c1 (patch)
tree65ffc4c42e7cb9aa2e8e3fcc092801da22be2510 /common/src/main/java/dev/isxander/yacl3/config/v2
parent66f313949726d76953c8afb8f19fdbfb5c5dc986 (diff)
downloadYetAnotherConfigLib-d1ef9c7286dbb241bf3fc072065edef3b20421c1.tar.gz
YetAnotherConfigLib-d1ef9c7286dbb241bf3fc072065edef3b20421c1.tar.bz2
YetAnotherConfigLib-d1ef9c7286dbb241bf3fc072065edef3b20421c1.zip
Re-throw exceptions when creating options
Diffstat (limited to 'common/src/main/java/dev/isxander/yacl3/config/v2')
-rw-r--r--common/src/main/java/dev/isxander/yacl3/config/v2/impl/ConfigClassHandlerImpl.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/common/src/main/java/dev/isxander/yacl3/config/v2/impl/ConfigClassHandlerImpl.java b/common/src/main/java/dev/isxander/yacl3/config/v2/impl/ConfigClassHandlerImpl.java
index 4851da7..dd14ed0 100644
--- a/common/src/main/java/dev/isxander/yacl3/config/v2/impl/ConfigClassHandlerImpl.java
+++ b/common/src/main/java/dev/isxander/yacl3/config/v2/impl/ConfigClassHandlerImpl.java
@@ -102,7 +102,13 @@ public class ConfigClassHandlerImpl<T> implements ConfigClassHandler<T> {
.name(Component.translatable("yacl3.config.%s.category.%s.group.%s".formatted(id().toString(), autoGen.category(), k)));
});
- Option<?> option = createOption(configField, storage);
+ Option<?> option;
+ try {
+ option = createOption(configField, storage);
+ } catch (Exception e) {
+ throw new YACLAutoGenException("Failed to create option for field '%s'".formatted(configField.access().name()), e);
+ }
+
storage.putOption(configField.access().name(), option);
group.option(option);
});