- match TemplateContextGetter::get(context, &collection) {
- Some(TemplateValue::Collection(collection)) => {
+ let value = TemplateContextGetter::get(context, &collection)
+ .ok_or_else(|| Error::new(Other, format!("{} is not a valid key", collection)))?;
+
+ match value {
+ TemplateValue::Collection(collection) => {