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

@ -114,12 +114,14 @@ fn expand(path: &Path, span: Span, args: &Arguments) -> Value {
Value::string(p.to_string_lossy(), span)
} else if args.strict {
Value::Error {
error: ShellError::SpannedLabeledError(
error: ShellError::GenericError(
"Could not expand path".into(),
"could not be expanded (path might not exist, non-final \
component is not a directory, or other cause)"
.into(),
span,
Some(span),
None,
Vec::new(),
),
}
} else {

View File

@ -120,7 +120,7 @@ fn relative_to(path: &Path, span: Span, args: &Arguments) -> Value {
match lhs.strip_prefix(&rhs) {
Ok(p) => Value::string(p.to_string_lossy(), span),
Err(e) => Value::Error {
error: ShellError::CantConvert(e.to_string(), "string".into(), span),
error: ShellError::CantConvert(e.to_string(), "string".into(), span, None),
},
}
}