diff options
author | Jesse Luehrs <doy@tozt.net> | 2020-04-12 00:08:03 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2020-04-12 00:08:03 -0400 |
commit | 236f06736e45c2a70f43589c9d447a0a3ef240b5 (patch) | |
tree | c390d4cbfec5223ac1aefe3947f8e1bb885757d2 /src/db.rs | |
parent | 91d1d1890bdc3ee75b69e00d5368c5b29a4f461c (diff) | |
download | rbw-236f06736e45c2a70f43589c9d447a0a3ef240b5.tar.gz rbw-236f06736e45c2a70f43589c9d447a0a3ef240b5.zip |
improve error handling and reporting
Diffstat (limited to 'src/db.rs')
-rw-r--r-- | src/db.rs | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -45,6 +45,8 @@ impl Db { // XXX need to make this atomic pub fn save(&self, email: &str) -> Result<()> { let filename = Self::filename(email); + // unwrap is safe here because Self::filename is explicitly + // constructed as a filename in a directory std::fs::create_dir_all(filename.parent().unwrap()) .context(crate::error::SaveDb)?; let mut fh = @@ -61,6 +63,8 @@ impl Db { // XXX need to make this atomic pub async fn save_async(&self, email: &str) -> Result<()> { let filename = Self::filename(email); + // unwrap is safe here because Self::filename is explicitly + // constructed as a filename in a directory tokio::fs::create_dir_all(filename.parent().unwrap()) .await .context(crate::error::SaveDbAsync)?; |