fix: catch exceptions during translation service initialization
This commit is contained in:
parent
e1be8aeed9
commit
3c31d78ab8
|
@ -2,6 +2,8 @@ package io.gitlab.jfronny.googlechat;
|
||||||
|
|
||||||
import io.gitlab.jfronny.commons.io.cache.FixedSizeMap;
|
import io.gitlab.jfronny.commons.io.cache.FixedSizeMap;
|
||||||
import io.gitlab.jfronny.commons.logging.Logger;
|
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.Language;
|
||||||
import io.gitlab.jfronny.libjf.translate.api.TranslateService;
|
import io.gitlab.jfronny.libjf.translate.api.TranslateService;
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
|
@ -30,7 +32,7 @@ public class GoogleChat implements ModInitializer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInitialize() {
|
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() {
|
public static void onConfigChange() {
|
||||||
|
|
Loading…
Reference in New Issue