Skip to content

Commit

Permalink
log::error and std::process::exit instead
Browse files Browse the repository at this point in the history
  • Loading branch information
datdenkikniet committed Jul 11, 2023
1 parent 1dc9bf9 commit e81fa0b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions server/src/arg_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ pub struct StatsOptions {
/// The YAML configuration file describing to what influxdb2 the
/// stats should be written (over HTTP)
#[cfg(feature = "influxdb2")]
#[clap(long)]
#[clap(long = "influxdb-config")]
stats_influxdb_config: Option<PathBuf>,
}

Expand Down Expand Up @@ -145,20 +145,22 @@ impl StatsOptions {
let file = match std::fs::File::open(config) {
Ok(v) => v,
Err(e) => {
panic!(
log::error!(
"Could not open influxdb config file (\"{}\"). {e}",
config.as_os_str().to_str().unwrap()
);
std::process::exit(1);
}
};

let options = match serde_yaml::from_reader(file) {
Ok(o) => o,
Err(e) => {
panic!(
log::error!(
"Failed to parse influxdb config (\"{}\"). {e}",
config.as_os_str().to_str().unwrap()
);
std::process::exit(1);
}
};

Expand Down Expand Up @@ -189,7 +191,8 @@ impl Opts {
let mut parts = lower_case.split("x");

if parts.clone().count() != 2 {
panic!("Invalid stats offset");
log::error!("Invalid stats offset");
std::process::exit(1);
}

(
Expand Down

0 comments on commit e81fa0b

Please sign in to comment.