fix: catch exceptions during translation service initialization

This commit is contained in:
Johannes Frohnmeyer 2024-04-05 15:34:51 +02:00
parent e1be8aeed9
commit 3c31d78ab8
Signed by: Johannes
GPG Key ID: E76429612C2929F4
1 changed files with 3 additions and 1 deletions

View File

@ -2,6 +2,8 @@ package io.gitlab.jfronny.googlechat;
import io.gitlab.jfronny.commons.io.cache.FixedSizeMap;
import io.gitlab.jfronny.commons.logging.Logger;
import io.gitlab.jfronny.commons.throwable.Coerce;
import io.gitlab.jfronny.commons.throwable.Try;
import io.gitlab.jfronny.libjf.translate.api.Language;
import io.gitlab.jfronny.libjf.translate.api.TranslateService;
import net.fabricmc.api.EnvType;
@ -30,7 +32,7 @@ public class GoogleChat implements ModInitializer {
@Override
public void onInitialize() {
ForkJoinPool.commonPool().execute(() -> TRANSLATE_SERVICE = TranslateService.getConfigured());
ForkJoinPool.commonPool().execute(Try.handle(Coerce.runnable(() -> TRANSLATE_SERVICE = TranslateService.getConfigured()), e -> LOGGER.error("Could not initialize translation service", e)));
}
public static void onConfigChange() {