X-Git-Url: https://git.r.bdr.sh/rbdr/blog/blobdiff_plain/172f4c8807d44ebe38c7f227b7fdc2d6a9dbe323..d62c4ea8debf01c2e251ef0c2520f947662f6c52:/src/remote/mod.rs?ds=inline 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 {