X-Git-Url: https://git.r.bdr.sh/rbdr/blog/blobdiff_plain/172f4c8807d44ebe38c7f227b7fdc2d6a9dbe323..c4b892b16fb92c7d89eaee0b1588c52c8836216b:/src/remote/mod.rs?ds=sidebyside diff --git a/src/remote/mod.rs b/src/remote/mod.rs index de90ef5..19514af 100644 --- a/src/remote/mod.rs +++ b/src/remote/mod.rs @@ -27,7 +27,7 @@ pub fn remove(remote_config: &PathBuf) -> Result<()> { pub fn sync_up(data_directory: &PathBuf, remote_config: &PathBuf) -> Result<()> { let remote_address = read_remote(remote_config) - .expect("No remote is configured"); + .ok_or_else(|| Error::new(Other, "No remote is configured"))?; create_dir_all(data_directory)?; let remotes = available_remotes(); for remote in remotes { @@ -40,7 +40,7 @@ pub fn sync_up(data_directory: &PathBuf, remote_config: &PathBuf) -> Result<()> pub fn sync_down(data_directory: &PathBuf, remote_config: &PathBuf) -> Result<()> { let remote_address = read_remote(remote_config) - .expect("No remote is configured"); + .ok_or_else(|| Error::new(Other, "No remote is configured"))?; create_dir_all(data_directory)?; let remotes = available_remotes(); for remote in remotes {