refactor(link): add LinkError and propagate errors up to runner #14

Merged
cafkafk merged 6 commits from cafk-link-result-refactor into main 2023-10-17 07:09:30 +02:00
Showing only changes of commit 41334cdaf0 - Show all commits

View file

@ -198,7 +198,6 @@ impl Link {
let tx_path: &Path = std::path::Path::new(&self.tx); let tx_path: &Path = std::path::Path::new(&self.tx);
let rx_path: &Path = std::path::Path::new(&self.rx); let rx_path: &Path = std::path::Path::new(&self.rx);
match rx_path.try_exists() { match rx_path.try_exists() {
// TODO: unwrap defeats the purpose here.
Ok(true) => handle_file_exists(self, tx_path, rx_path), Ok(true) => handle_file_exists(self, tx_path, rx_path),
Ok(false) if rx_path.is_symlink() => Err(LinkError::FileExists( Ok(false) if rx_path.is_symlink() => Err(LinkError::FileExists(
tx_path.to_string_lossy().to_string(), tx_path.to_string_lossy().to_string(),