Warn when there are unknown config options
This commit is contained in:
parent
32804c1f09
commit
17154c30cb
1 changed files with 10 additions and 9 deletions
|
|
@ -394,22 +394,23 @@ macro_rules! create_config {
|
|||
$(
|
||||
stringify!($i) => (),
|
||||
)+
|
||||
_ => {
|
||||
let msg =
|
||||
&format!("Warning: Unknown configuration option `{}`\n",
|
||||
key);
|
||||
err.push_str(msg)
|
||||
}
|
||||
_ => {
|
||||
let msg =
|
||||
&format!("Warning: Unknown configuration option `{}`\n", key);
|
||||
err.push_str(msg)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
match parsed.try_into() {
|
||||
Ok(parsed_config) =>
|
||||
Ok(Config::default().fill_from_parsed_config(parsed_config)),
|
||||
Ok(parsed_config) => {
|
||||
eprintln!("{}", err);
|
||||
Ok(Config::default().fill_from_parsed_config(parsed_config))
|
||||
}
|
||||
Err(e) => {
|
||||
err.push_str("Error: Decoding config file failed:\n");
|
||||
err.push_str(format!("{}\n", e).as_str());
|
||||
err.push_str("Please check your config file.\n");
|
||||
err.push_str("Please check your config file.");
|
||||
Err(err)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue