aboutsummaryrefslogtreecommitdiff
path: root/src/command/update.rs
diff options
context:
space:
mode:
authorRuben Beltran del Rio <git@r.bdr.sh>2024-03-09 15:34:57 +0100
committerRuben Beltran del Rio <git@r.bdr.sh>2024-03-09 15:34:57 +0100
commit50f53dc480fda8b3daab7a34454c2dd9f3f5f991 (patch)
tree2205be7a9c806ce59c851de9b50b9e18f973008d /src/command/update.rs
parent172f4c8807d44ebe38c7f227b7fdc2d6a9dbe323 (diff)
Improve the error handlingrust
Diffstat (limited to 'src/command/update.rs')
-rw-r--r--src/command/update.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/command/update.rs b/src/command/update.rs
index 67cc462..8a3d6de 100644
--- a/src/command/update.rs
+++ b/src/command/update.rs
@@ -55,7 +55,8 @@ impl super::Command for Update {
}
fn execute(&self, input: Option<&String>, configuration: &Configuration, _: &String) -> Result<()> {
- let input = input.expect("You must provide a path to a post");
+ let input = input
+ .ok_or_else(|| Error::new(ErrorKind::InvalidInput, "You must provide a path to a post"))?;
let post_location = PathBuf::from(input);
if !post_location.exists() {
return Err(Error::new(ErrorKind::NotFound, "The path provided does not exist"));