refactor: TemplateLoader to protocol, follow Swift API guidelines

This commit is contained in:
Kyle Fuller
2016-11-28 03:50:53 +00:00
parent 5ca1b78854
commit 429290e0b7
9 changed files with 65 additions and 34 deletions

View File

@@ -27,9 +27,8 @@ class IncludeNode : NodeType {
throw TemplateSyntaxError("'\(self.templateName)' could not be resolved as a string")
}
guard let template = loader.loadTemplate(templateName) else {
let paths = loader.paths.map { $0.description }.joined(separator: ", ")
throw TemplateSyntaxError("'\(templateName)' template not found in \(paths)")
guard let template = try loader.loadTemplate(name: templateName) else {
throw TemplateSyntaxError("'\(templateName)' template not found")
}
return try template.render(context)