refactor(loader): Throw when template not found

This commit is contained in:
Kyle Fuller
2016-11-30 17:07:38 +00:00
parent 63c2b935f7
commit 2ebb79df8b
8 changed files with 156 additions and 10 deletions

14
Sources/Errors.swift Normal file
View File

@@ -0,0 +1,14 @@
public class TemplateDoesNotExist: Error, CustomStringConvertible {
let templateNames: [String]
let loader: Loader
public init(templateNames: [String], loader: Loader) {
self.templateNames = templateNames
self.loader = loader
}
public var description: String {
let templates = templateNames.joined(separator: ", ")
return "Template named `\(templates)` does not exist in loader \(loader)"
}
}