!Slightly improved loading error messages

This commit is contained in:
Indyuce 2020-08-15 13:19:14 +02:00
parent 6827c0051b
commit 9a37ed70e3

View File

@ -59,8 +59,7 @@ public class MMOLoadManager {
private <T> T load(Class<T> c, MMOLineConfig config, Function<MMOLoader, T> func) { private <T> T load(Class<T> c, MMOLineConfig config, Function<MMOLoader, T> func) {
for (MMOLoader loader : loaders) { for (MMOLoader loader : loaders)
try { try {
T found = func.apply(loader); T found = func.apply(loader);
if (found != null) if (found != null)
@ -68,8 +67,7 @@ public class MMOLoadManager {
} catch (IllegalArgumentException | JsonParseException | IndexOutOfBoundsException exception) { } catch (IllegalArgumentException | JsonParseException | IndexOutOfBoundsException exception) {
throw new IllegalArgumentException(exception.getMessage()); throw new IllegalArgumentException(exception.getMessage());
} }
}
throw new IllegalArgumentException("Could not find corresponding " + c.getSimpleName() + " in database"); throw new IllegalArgumentException("Could not match any " + c.getSimpleName() + " to '" + config.getKey() + "' in database");
} }
} }