Skip to content

Commit

Permalink
ref: Provide better user messages for properties file configs (#1336)
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilogorek committed Sep 22, 2022
1 parent 2cac02b commit 66d83cb
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/config.rs
Expand Up @@ -10,7 +10,7 @@ use anyhow::{bail, format_err, Context, Error, Result};
use clap::ArgMatches;
use ini::Ini;
use lazy_static::lazy_static;
use log::set_max_level;
use log::{debug, info, set_max_level, warn};
use parking_lot::Mutex;
use sentry::types::Dsn;

Expand Down Expand Up @@ -518,11 +518,17 @@ fn load_cli_config() -> Result<(PathBuf, Ini)> {
bail!("Could not load java style properties file: {}", err);
}
};
info!(
"Loaded file referenced by SENTRY_PROPERTIES ({})",
&prop_path
);
for (key, value) in props {
let mut iter = key.rsplitn(2, '.');
if let Some(key) = iter.next() {
let section = iter.next();
rv.set_to(section, key.to_string(), value);
} else {
debug!("Incorrect properties file key: {}", key);
}
}
}
Expand All @@ -532,6 +538,11 @@ fn load_cli_config() -> Result<(PathBuf, Ini)> {
"Failed to load file referenced by SENTRY_PROPERTIES ({})",
&prop_path
)));
} else {
warn!(
"Failed to find file referenced by SENTRY_PROPERTIES ({})",
&prop_path
);
}
}
}
Expand Down

0 comments on commit 66d83cb

Please sign in to comment.