Skip to content

Commit

Permalink
Improve template error reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
RedNesto committed Jun 30, 2024
1 parent 45ddab6 commit 2e1f8bd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main/kotlin/creator/custom/CustomPlatformStep.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 2e1f8bd

Please sign in to comment.