User: rednesto Date: 06 Feb 24 19:23 Revision: d34c35c5036669e2d23664eb349288e8b200096e Summary: Don't log errors if no details are provided when auto reimport fails Show a notification instead TeamCity URL: https://ci.mcdev.io/viewModification.html?tab=vcsModificationFiles&modId=9109&personal=false Index: src/main/kotlin/facet/ProjectReimporter.kt =================================================================== --- src/main/kotlin/facet/ProjectReimporter.kt (revision 8eb05a2d3c6d4eed408552c00755f61dccb8afa7) +++ src/main/kotlin/facet/ProjectReimporter.kt (revision d34c35c5036669e2d23664eb349288e8b200096e) @@ -20,6 +20,9 @@ package com.demonwav.mcdev.facet +import com.demonwav.mcdev.asset.MCDevBundle +import com.intellij.notification.Notification +import com.intellij.notification.NotificationType import com.intellij.openapi.actionSystem.ActionManager import com.intellij.openapi.actionSystem.ActionPlaces import com.intellij.openapi.diagnostic.logger @@ -57,7 +60,23 @@ true ) callback.doWhenRejected { error -> + if (error == null) { + Notification( + "Minecraft facet", + MCDevBundle("facet.reimport.failed.title"), + MCDevBundle("facet.reimport.failed.content.no_error"), + NotificationType.WARNING + ).notify(project) + log.warn("Rejected refresh all projects, no details provided") + } else { + Notification( + "Minecraft facet", + MCDevBundle("facet.reimport.failed.title"), + MCDevBundle("facet.reimport.failed.content.with_error", error), + NotificationType.WARNING + ).notify(project) - log.error("Rejected refresh all projects: $error") - } - } -} + log.error("Rejected refresh all projects: $error") + } + } + } +} Index: src/main/resources/META-INF/plugin.xml =================================================================== --- src/main/resources/META-INF/plugin.xml (revision 8eb05a2d3c6d4eed408552c00755f61dccb8afa7) +++ src/main/resources/META-INF/plugin.xml (revision d34c35c5036669e2d23664eb349288e8b200096e) @@ -186,6 +186,7 @@ + Index: src/main/resources/messages/MinecraftDevelopment.properties =================================================================== --- src/main/resources/messages/MinecraftDevelopment.properties (revision 8eb05a2d3c6d4eed408552c00755f61dccb8afa7) +++ src/main/resources/messages/MinecraftDevelopment.properties (revision d34c35c5036669e2d23664eb349288e8b200096e) @@ -92,6 +92,9 @@ error_reporter.report.error.action=Open an issue on the GitHub issue tracker facet.editor.name=Minecraft Module Settings +facet.reimport.failed.title=Minecraft facet refresh +facet.reimport.failed.content.no_error=Failed to start project refresh, please refresh your project manually. +facet.reimport.failed.content.with_error=Failed to start project refresh, please refresh your project manually. Cause: {0} generate.event_listener.title=Generate Event Listener generate.event_listener.settings=Event Listener Settings