User: rednesto Date: 15 Sep 23 11:32 Revision: 274598997db38fc0a82af3e751ebad9a3cc1f9d2 Summary: Stop logging connection errors in the creator TeamCity URL: https://ci.mcdev.io/viewModification.html?tab=vcsModificationFiles&modId=8722&personal=false Index: src/main/kotlin/creator/step/AbstractLatentStep.kt =================================================================== --- src/main/kotlin/creator/step/AbstractLatentStep.kt (revision 5b49b4d29de27319f1f7c6727629e7720646f14f) +++ src/main/kotlin/creator/step/AbstractLatentStep.kt (revision 274598997db38fc0a82af3e751ebad9a3cc1f9d2) @@ -84,12 +84,12 @@ return@launch } - val result = asyncIO { + val (result: T?, errorMessage: String?) = asyncIO { try { - computeData() + computeData() to null } catch (e: Throwable) { - LOGGER.error(e) - null + LOGGER.warn("computeData failed", e) + null to e.message } }.await() @@ -105,17 +105,11 @@ if (result == null) { placeholder.component = panel { row { - val label = label(MCDevBundle("creator.ui.generic_validation_failure.message", description)) + val labelValidationText = + MCDevBundle("creator.ui.generic_validation_failure.message", description, errorMessage) + val label = label(labelValidationText) .validationRequestor(AFTER_GRAPH_PROPAGATION(propertyGraph)) - .validation( - DialogValidation { - val labelValidationText = MCDevBundle( - "creator.ui.generic_validation_failure.message", - description - ) - ValidationInfo(labelValidationText) - } - ) + .validation(DialogValidation { ValidationInfo(labelValidationText) }) label.component.foreground = JBColor.RED } } Index: src/main/kotlin/platform/bukkit/creator/ui-steps.kt =================================================================== --- src/main/kotlin/platform/bukkit/creator/ui-steps.kt (revision 5b49b4d29de27319f1f7c6727629e7720646f14f) +++ src/main/kotlin/platform/bukkit/creator/ui-steps.kt (revision 274598997db38fc0a82af3e751ebad9a3cc1f9d2) @@ -78,12 +78,8 @@ override val description = "download versions" override suspend fun computeData() = coroutineScope { - try { - asyncIO { getVersionSelector(platform) }.await() + asyncIO { getVersionSelector(platform) }.await() - } catch (e: Throwable) { - null - } + } - } override fun createStep(data: PlatformVersion) = SimpleMcVersionStep(this, data.versions.mapNotNull(SemanticVersion::tryParse)) Index: src/main/kotlin/platform/bungeecord/creator/ui-steps.kt =================================================================== --- src/main/kotlin/platform/bungeecord/creator/ui-steps.kt (revision 5b49b4d29de27319f1f7c6727629e7720646f14f) +++ src/main/kotlin/platform/bungeecord/creator/ui-steps.kt (revision 274598997db38fc0a82af3e751ebad9a3cc1f9d2) @@ -72,12 +72,8 @@ override val description = "download versions" override suspend fun computeData() = coroutineScope { - try { - asyncIO { getVersionSelector(platform) }.await() + asyncIO { getVersionSelector(platform) }.await() - } catch (e: Throwable) { - null - } + } - } override fun createStep(data: PlatformVersion) = SimpleMcVersionStep(this, data.versions.mapNotNull(SemanticVersion::tryParse)) Index: src/main/kotlin/platform/sponge/SpongeVersion.kt =================================================================== --- src/main/kotlin/platform/sponge/SpongeVersion.kt (revision 5b49b4d29de27319f1f7c6727629e7720646f14f) +++ src/main/kotlin/platform/sponge/SpongeVersion.kt (revision 274598997db38fc0a82af3e751ebad9a3cc1f9d2) @@ -20,23 +20,12 @@ package com.demonwav.mcdev.platform.sponge -import com.demonwav.mcdev.creator.getText -import com.demonwav.mcdev.util.fromJson -import com.google.gson.Gson -import com.intellij.openapi.diagnostic.logger +import com.demonwav.mcdev.creator.getVersionJson data class SpongeVersion(var versions: LinkedHashMap, var selectedIndex: Int) { companion object { - private val LOGGER = logger() - suspend fun downloadData(): SpongeVersion? { - return try { - val text = getText("sponge_v2.json") - Gson().fromJson(text, SpongeVersion::class) - } catch (e: Exception) { - LOGGER.error("Failed to download Sponge version json", e) - null + return getVersionJson("sponge_v2.json") - } - } - } + } + } +} -} Index: src/main/kotlin/platform/velocity/creator/ui-steps.kt =================================================================== --- src/main/kotlin/platform/velocity/creator/ui-steps.kt (revision 5b49b4d29de27319f1f7c6727629e7720646f14f) +++ src/main/kotlin/platform/velocity/creator/ui-steps.kt (revision 274598997db38fc0a82af3e751ebad9a3cc1f9d2) @@ -51,12 +51,8 @@ override val description = "download Velocity versions" override suspend fun computeData() = coroutineScope { - try { - asyncIO { getVersionSelector(PlatformType.VELOCITY) }.await() + asyncIO { getVersionSelector(PlatformType.VELOCITY) }.await() - } catch (e: Throwable) { - null - } + } - } override fun createStep(data: PlatformVersion) = VelocityVersionStep(this, data.versions.mapNotNull(SemanticVersion::tryParse)) Index: src/main/resources/messages/MinecraftDevelopment.properties =================================================================== --- src/main/resources/messages/MinecraftDevelopment.properties (revision 5b49b4d29de27319f1f7c6727629e7720646f14f) +++ src/main/resources/messages/MinecraftDevelopment.properties (revision 274598997db38fc0a82af3e751ebad9a3cc1f9d2) @@ -50,7 +50,7 @@ creator.ui.outdated.message=Is the Minecraft project wizard outdated? \ Create an issue on the MinecraftDev issue tracker. -creator.ui.generic_validation_failure.message=Unable to {0} +creator.ui.generic_validation_failure.message=Unable to {0} {1} creator.ui.generic_unfinished.message=Haven''t finished {0} creator.ui.create_minecraft_project=Create a new Minecraft project