diff options
| author | Ruben Beltran del Rio <git@r.bdr.sh> | 2024-03-09 15:34:57 +0100 |
|---|---|---|
| committer | Ruben Beltran del Rio <git@r.bdr.sh> | 2024-03-09 15:34:57 +0100 |
| commit | 50f53dc480fda8b3daab7a34454c2dd9f3f5f991 (patch) | |
| tree | 2205be7a9c806ce59c851de9b50b9e18f973008d /src/command/update.rs | |
| parent | 172f4c8807d44ebe38c7f227b7fdc2d6a9dbe323 (diff) | |
Improve the error handlingrust
Diffstat (limited to 'src/command/update.rs')
| -rw-r--r-- | src/command/update.rs | 3 |
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")); |