Skip to content

Commit

Permalink
fix: propagate errors from save fn
Browse files Browse the repository at this point in the history
  • Loading branch information
louib committed Sep 29, 2024
1 parent 0420ba3 commit 641bfce
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/vault.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,9 +334,9 @@ impl Aegis {

/// Save the encrypted vault to a file
pub fn save(&mut self, destination: &mut dyn std::io::Write, password: &str) -> Result<()> {
self.encrypt(password).unwrap();
self.encrypt(password)?;

let raw_encrypted_vault = serde_json::ser::to_string_pretty(&self).unwrap();
let raw_encrypted_vault = serde_json::ser::to_string_pretty(&self)?;
destination.write(raw_encrypted_vault.as_bytes())?;
destination.flush()?;
Ok(())
Expand Down

0 comments on commit 641bfce

Please sign in to comment.