let sn = sn.parse().dcontext(&sn)?;
let vars = §ion.values;
- for key in vars.keys() {
- let skl = if key == "server" {
- SKL::ServerName
- } else {
- *self.keys_allowed.get(key.as_str()).ok_or_else(
- || anyhow!("unknown configuration key {:?}", key)
- )?
- };
- if ! skl.contains(&sn, self.end) {
- throw!(anyhow!(
- "configuration key {:?} not applicable in this kind of section: {}",
- key, &sn))
- }
+ for (key, val) in vars {
+ (||{
+ let skl = if key == "server" {
+ SKL::ServerName
+ } else {
+ *self.keys_allowed.get(key.as_str()).ok_or_else(
+ || anyhow!("unknown configuration key")
+ )?
+ };
+ if ! skl.contains(&sn, self.end) {
+ throw!(anyhow!("key not applicable in this kind of section"))
+ }
+ Ok::<_,AE>(())
+ })()
+ .with_context(|| format!("key {:?}", key))
+ .with_context(|| val.loc.to_string())?
}
let ent = self.sections.entry(sn)
Ok::<_,AE>(unq)
})()
.with_context(|| format!("key {:?}", key))
- .dcontext(path_for_loc)?
+ .with_context(|| loc.to_string())?
} else {
raw.clone()
};