mirror of
https://github.com/nushell/nushell.git
synced 2025-07-01 07:00:37 +02:00
update miette and switch to GenericErrors (#5222)
This commit is contained in:
@ -85,10 +85,12 @@ impl Command for Complete {
|
||||
}
|
||||
.into_pipeline_data())
|
||||
}
|
||||
_ => Err(ShellError::SpannedLabeledError(
|
||||
_ => Err(ShellError::GenericError(
|
||||
"Complete only works with external streams".to_string(),
|
||||
"complete only works on external streams".to_string(),
|
||||
call.head,
|
||||
Some(call.head),
|
||||
None,
|
||||
Vec::new(),
|
||||
)),
|
||||
}
|
||||
}
|
||||
|
@ -93,10 +93,12 @@ fn exec(
|
||||
println!("{:#?}", command);
|
||||
let err = command.exec(); // this replaces our process, should not return
|
||||
|
||||
Err(ShellError::SpannedLabeledError(
|
||||
Err(ShellError::GenericError(
|
||||
"Error on exec".to_string(),
|
||||
err.to_string(),
|
||||
name_span,
|
||||
Some(name_span),
|
||||
None,
|
||||
Vec::new(),
|
||||
))
|
||||
}
|
||||
|
||||
@ -106,9 +108,11 @@ fn exec(
|
||||
_stack: &mut Stack,
|
||||
call: &Call,
|
||||
) -> Result<nu_protocol::PipelineData, nu_protocol::ShellError> {
|
||||
Err(ShellError::SpannedLabeledError(
|
||||
Err(ShellError::GenericError(
|
||||
"Error on exec".to_string(),
|
||||
"exec is not supported on your platform".to_string(),
|
||||
call.head,
|
||||
Some(call.head),
|
||||
None,
|
||||
Vec::new(),
|
||||
))
|
||||
}
|
||||
|
@ -345,14 +345,15 @@ impl ExternalCommand {
|
||||
process.current_dir(d);
|
||||
process
|
||||
} else {
|
||||
return Err(ShellError::SpannedLabeledErrorHelp(
|
||||
return Err(ShellError::GenericError(
|
||||
"Current directory not found".to_string(),
|
||||
"did not find PWD environment variable".to_string(),
|
||||
span,
|
||||
concat!(
|
||||
Some(span),
|
||||
Some(concat!(
|
||||
"The environment variable 'PWD' was not found. ",
|
||||
"It is required to define the current directory when running an external command."
|
||||
).to_string(),
|
||||
).to_string()),
|
||||
Vec::new(),
|
||||
));
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user