diff --git a/src/main/kotlin/com/github/suhli/ideagokratosplugin/helper/CmdHelper.kt b/src/main/kotlin/com/github/suhli/ideagokratosplugin/helper/CmdHelper.kt index 7a6cda3..0162845 100644 --- a/src/main/kotlin/com/github/suhli/ideagokratosplugin/helper/CmdHelper.kt +++ b/src/main/kotlin/com/github/suhli/ideagokratosplugin/helper/CmdHelper.kt @@ -12,6 +12,22 @@ import com.intellij.openapi.fileEditor.FileEditorManager import com.intellij.openapi.progress.runBackgroundableTask import com.intellij.openapi.project.Project +private fun errorAlert(project: Project, task: String, message: String?) { + Notifications.Bus.notify( + Notification( + "com.github.suhli.ideagokratosplugin", + "$task failed:\n${message ?: ""}", + NotificationType.ERROR + ), project + ) +} + +private fun runTask(project: Project, taskName: String, t: KratosTask) { + val result = t.runnable() + if (result?.exception != null) { + errorAlert(project, taskName, result.message) + } +} fun runKratosTaskInBackground(taskName: String, project: Project, tasks: List) { if (tasks.isEmpty()) { @@ -19,24 +35,31 @@ fun runKratosTaskInBackground(taskName: String, project: Project, tasks: List