diff options
Diffstat (limited to 'src/select/selection_file/duration.rs')
-rw-r--r-- | src/select/selection_file/duration.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/select/selection_file/duration.rs b/src/select/selection_file/duration.rs index f7a39cb..a38981c 100644 --- a/src/select/selection_file/duration.rs +++ b/src/select/selection_file/duration.rs @@ -23,9 +23,11 @@ impl FromStr for Duration { fn from_str(s: &str) -> Result<Self, Self::Err> { fn parse_num(str: &str, suffix: char) -> Result<u32> { str.strip_suffix(suffix) - .expect("it has a 'h' suffix") + .with_context(|| { + format!("Failed to strip suffix '{}' of number: '{}'", suffix, str) + })? .parse::<u32>() - .context("Failed to parse hours") + .with_context(|| format!("Failed to parse '{}'", suffix)) } if s == "[No Duration]" { |