From 2e1f8bd9a4bbccfb6127342938b27c49c063c260 Mon Sep 17 00:00:00 2001 From: RedNesto Date: Sun, 30 Jun 2024 11:48:42 +0200 Subject: [PATCH] Improve template error reporting --- src/main/kotlin/creator/custom/CustomPlatformStep.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/creator/custom/CustomPlatformStep.kt b/src/main/kotlin/creator/custom/CustomPlatformStep.kt index 8ca8bbe12..a25fe1fbb 100644 --- a/src/main/kotlin/creator/custom/CustomPlatformStep.kt +++ b/src/main/kotlin/creator/custom/CustomPlatformStep.kt @@ -38,6 +38,7 @@ import com.intellij.ide.wizard.AbstractNewProjectWizardStep import com.intellij.ide.wizard.GitNewProjectWizardData import com.intellij.ide.wizard.NewProjectWizardBaseData import com.intellij.ide.wizard.NewProjectWizardStep +import com.intellij.openapi.diagnostic.Attachment import com.intellij.openapi.diagnostic.ControlFlowException import com.intellij.openapi.diagnostic.getOrLogException import com.intellij.openapi.diagnostic.logger @@ -476,7 +477,11 @@ class CustomPlatformStep( } val processedContent = TemplateEvaluator.template(fileTemplateProperties, templateContents) - .getOrLogException(thisLogger()) + .onFailure { t -> + val attachment = Attachment(relativeTemplate, templateContents) + thisLogger().error("Failed evaluate template '$relativeTemplate'", t, attachment) + } + .getOrNull() ?: continue destPath.parent.createDirectories()