From 21699acc258b39d5c54605554620ca23e40d87b1 Mon Sep 17 00:00:00 2001 From: carbotaniuman <41451839+carbotaniuman@users.noreply.github.com> Date: Tue, 1 Sep 2020 12:00:18 -0500 Subject: [PATCH] Fix random arbitrary shutdown by using exceptions --- src/main/kotlin/mdnet/base/ServerManager.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/mdnet/base/ServerManager.kt b/src/main/kotlin/mdnet/base/ServerManager.kt index 6a08d49..4c7e373 100644 --- a/src/main/kotlin/mdnet/base/ServerManager.kt +++ b/src/main/kotlin/mdnet/base/ServerManager.kt @@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.databind.SerializationFeature import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper import com.fasterxml.jackson.module.kotlin.readValue +import java.lang.RuntimeException import java.time.Instant import java.util.Collections import java.util.LinkedHashMap @@ -145,7 +146,7 @@ class ServerManager(serverSettings: ServerSettings, devSettings: DevSettings, ma } } } catch (e: Exception) { - LOGGER.warn(e) { "Main loop failed" } + LOGGER.error(e) { "Main loop failed" } } }, 15, 15, TimeUnit.SECONDS) @@ -199,7 +200,8 @@ class ServerManager(serverSettings: ServerSettings, devSettings: DevSettings, ma val state = this.state as Uninitialized val remoteSettings = serverHandler.loginToControl() - ?: Main.dieWithError("Failed to get a login response from server - check API secret for validity") + ?: throw RuntimeException("Failed to get a login response from server") + val server = getServer(cache, database, remoteSettings, state.serverSettings, statistics, isHandled).start() if (remoteSettings.latestBuild > Constants.CLIENT_BUILD) {