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

@ -57,17 +57,21 @@ impl Command for ViewSource {
Ok(Value::string(String::from_utf8_lossy(contents), call.head)
.into_pipeline_data())
} else {
Err(ShellError::SpannedLabeledError(
Err(ShellError::GenericError(
"Cannot view value".to_string(),
"the command does not have a viewable block".to_string(),
arg_span,
Some(arg_span),
None,
Vec::new(),
))
}
} else {
Err(ShellError::SpannedLabeledError(
Err(ShellError::GenericError(
"Cannot view value".to_string(),
"the command does not have a viewable block".to_string(),
arg_span,
Some(arg_span),
None,
Vec::new(),
))
}
} else if let Some(overlay_id) = engine_state.find_overlay(val.as_bytes()) {
@ -78,24 +82,30 @@ impl Command for ViewSource {
Ok(Value::string(String::from_utf8_lossy(contents), call.head)
.into_pipeline_data())
} else {
Err(ShellError::SpannedLabeledError(
Err(ShellError::GenericError(
"Cannot view value".to_string(),
"the module does not have a viewable block".to_string(),
arg_span,
Some(arg_span),
None,
Vec::new(),
))
}
} else {
Err(ShellError::SpannedLabeledError(
Err(ShellError::GenericError(
"Cannot view value".to_string(),
"this name does not correspond to a viewable value".to_string(),
arg_span,
Some(arg_span),
None,
Vec::new(),
))
}
}
_ => Err(ShellError::SpannedLabeledError(
_ => Err(ShellError::GenericError(
"Cannot view value".to_string(),
"this value cannot be viewed".to_string(),
arg_span,
Some(arg_span),
None,
Vec::new(),
)),
}
}