Skip to content

Commit 38e8f64

Browse files
committed
Handle template scan error for a single folder
If an error occurs due to an invalid template.json file when scanning a folder this exception is caught and logged and then the next folder is tried. Previously an exception would stop the processing of all the other folders so valid templates would not be available.
1 parent 0b15e10 commit 38e8f64

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/MonoDevelop.TemplateCreator/MonoDevelop.Templating/TemplatingEngine.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,12 @@ public void LoadTemplates ()
9292

9393
foreach (string folder in TemplatingServices.Options.TemplateFolders) {
9494
if (Directory.Exists (folder)) {
95-
settingsLoader.UserTemplateCache.Scan (folder);
95+
try {
96+
settingsLoader.UserTemplateCache.Scan (folder);
97+
} catch (Exception ex) {
98+
string message = string.Format ("Unable to load templates from folder '{0}.", folder);
99+
TemplatingServices.LogError (message, ex);
100+
}
96101
}
97102
}
98103

0 commit comments

Comments
 (0)