Skip to content

Commit

Permalink
fix(config): Don't show error when config is missing, instead just lo…
Browse files Browse the repository at this point in the history
…g it
  • Loading branch information
last-partizan committed Jun 11, 2023
1 parent ed58c49 commit 19748e1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/settings/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@ impl Config {
pub fn init() {
match Config::load_from_path(&config_path()) {
Ok(config) => config.write_to_env(),
Err(err) => {
eprintln!("{err}");
}
Err(Some(err)) => eprintln!("{err}"),
Err(None) => {}
};
}

Expand Down Expand Up @@ -75,13 +74,14 @@ impl Config {
}
}

fn load_from_path(path: &Path) -> Result<Self, String> {
fn load_from_path(path: &Path) -> Result<Self, Option<String>> {
let toml = std::fs::read_to_string(path).map_err(|e| {
format!(
log::debug!(
"Error while trying to open config file {}:\n{}\nContinuing with default config.",
path.to_string_lossy(),
e
)
);
None
})?;
let config = toml::from_str(&toml).map_err(|e| {
format!(
Expand Down

0 comments on commit 19748e1

Please sign in to comment.