Skip to content

Commit

Permalink
refactor: 💡 use anyhow::bail!
Browse files Browse the repository at this point in the history
  • Loading branch information
kohbis committed Sep 10, 2023
1 parent 6cc441c commit de39e54
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl Config {
fn read_from_file(&mut self, path: &Path) -> Result<&Self> {
let file = match File::open(path) {
Ok(file) => file,
Err(err) => return Err(anyhow!(err)),
Err(err) => anyhow::bail!("{}: {}", path.display(), err),
};

for line in BufReader::new(file).lines() {
Expand All @@ -71,7 +71,7 @@ impl Config {

fn validate(&mut self) -> Result<()> {
if self.token.is_empty() {
return Err(anyhow!("{} not found.", RSLACK_TOKEN));
anyhow::bail!("{} not found.", RSLACK_TOKEN);
}

Ok(())
Expand Down

0 comments on commit de39e54

Please sign in to comment.