summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Bridle <bridle.benjamin@gmail.com>2025-01-22 13:22:15 +1300
committerBen Bridle <bridle.benjamin@gmail.com>2025-01-22 13:22:15 +1300
commite3c4ff5e93f2cd95dfa73dd779202481ec5dd01b (patch)
tree103c5ca078b50fefb1901d140e38dbb1f9f74854
parentb511a1a64e9076a040baf3c02a1587c40d0ec172 (diff)
downloadtoaster-e3c4ff5e93f2cd95dfa73dd779202481ec5dd01b.zip
Improve error message when source directory cannot be found
-rw-r--r--src/main.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index 0fccc2b..2920917 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -51,7 +51,10 @@ fn main() {
if args.source.is_none() || args.destination.is_none() {
error!("Provide a source directory and a destination directory.")
}
- let source_directory = args.source.unwrap().canonicalize().unwrap();
+ let source_directory = match args.source.as_ref().unwrap().canonicalize() {
+ Ok(source_directory) => source_directory,
+ Err(err) => error!("{:?}: {err}", args.source.unwrap()),
+ };
let destination_directory = args.destination.unwrap();