Skip to content

Commit

Permalink
Catch any exception when selecting a version URL
Browse files Browse the repository at this point in the history
  • Loading branch information
DenWav committed Nov 17, 2023
1 parent ddb9af5 commit ea70318
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/main/kotlin/creator/PlatformVersion.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import com.demonwav.mcdev.update.PluginUtil
import com.demonwav.mcdev.util.fromJson
import com.demonwav.mcdev.util.mapFirstNotNull
import com.demonwav.mcdev.util.withSuppressed
import com.github.kittinunf.fuel.core.FuelError
import com.github.kittinunf.fuel.core.FuelManager
import com.github.kittinunf.fuel.core.requests.suspendable
import com.github.kittinunf.fuel.coroutines.awaitString
Expand Down Expand Up @@ -77,11 +76,11 @@ suspend fun <T : Any> getVersionJson(path: String, type: KClass<T>): T {
}

suspend fun getText(path: String): String {
var thrown: FuelError? = null
var thrown: Exception? = null
return URLS.mapFirstNotNull { url ->
try {
doCall(url + path)
} catch (e: FuelError) {
} catch (e: Exception) {
PLATFORM_VERSION_LOGGER.warn("Failed to reach URL $url$path")
thrown = withSuppressed(thrown, e)
null
Expand Down

0 comments on commit ea70318

Please sign in to comment.