Skip to content

Commit

Permalink
Display node config in error message upon parse failure
Browse files Browse the repository at this point in the history
  • Loading branch information
guilload committed Apr 16, 2024
1 parent ec88657 commit 45fcd2c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion quickwit/quickwit-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,11 @@ async fn load_node_config(config_uri: &Uri) -> anyhow::Result<NodeConfig> {
let config_format = ConfigFormat::sniff_from_uri(config_uri)?;
let config = NodeConfig::load(config_format, config_content.as_slice())
.await
.with_context(|| format!("failed to parse node config `{config_uri}`"))?;
.with_context(|| {
let config_str =
std::str::from_utf8(&config_content).expect("config should be valid utf-8");
format!("failed to parse node config `{config_uri}`: {config_str}")
})?;
info!(config_uri=%config_uri, config=?config, "loaded node config");
Ok(config)
}
Expand Down

0 comments on commit 45fcd2c

Please sign in to comment.