groue / GRMustache.swift

Flexible Mustache templates for Swift
http://mustache.github.com/
MIT License
594 stars 155 forks source link

Is it possible to throw an error when a tag inside a template is missing? #69

Open acecilia opened 4 years ago

acecilia commented 4 years ago

Is it possible to throw an error when a tag inside a template is missing? I could not find any issues mentioning this topic.

For example, using the example in the readme as a reference, instead of:

let template = try Template(string: "<{{#value}}Truthy{{/value}}>")
// "<>"
try template.render([:])                  // missing value

do:

let template = try Template(string: "<{{#value}}Truthy{{/value}}>")
// Throw error: missing value
try template.render([:])                  // missing value

Thanks!