update miette and switch to GenericErrors (#5222)

This commit is contained in:
Kat Marchán
2022-04-18 05:34:10 -07:00
committed by GitHub
parent cf65f77b02
commit 1314a87cb0
141 changed files with 1569 additions and 689 deletions

View File

@ -257,6 +257,7 @@ pub fn eval_expression(
"unit value".into(),
x.get_type().to_string(),
e.span,
None,
)),
},
Expr::Range(from, next, to, operator) => {
@ -1319,20 +1320,24 @@ fn compute(size: i64, unit: Unit, span: Span) -> Value {
Unit::Day => match size.checked_mul(1000 * 1000 * 1000 * 60 * 60 * 24) {
Some(val) => Value::Duration { val, span },
None => Value::Error {
error: ShellError::SpannedLabeledError(
error: ShellError::GenericError(
"duration too large".into(),
"duration too large".into(),
span,
Some(span),
None,
Vec::new(),
),
},
},
Unit::Week => match size.checked_mul(1000 * 1000 * 1000 * 60 * 60 * 24 * 7) {
Some(val) => Value::Duration { val, span },
None => Value::Error {
error: ShellError::SpannedLabeledError(
error: ShellError::GenericError(
"duration too large".into(),
"duration too large".into(),
span,
Some(span),
None,
Vec::new(),
),
},
},