mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 18:57:44 +02:00
update miette and switch to GenericErrors (#5222)
This commit is contained in:
@ -383,10 +383,12 @@ Format: #
|
||||
None => Color::White.prefix().to_string(),
|
||||
},
|
||||
Err(err) => {
|
||||
return Err(ShellError::SpannedLabeledError(
|
||||
return Err(ShellError::GenericError(
|
||||
"error parsing hex color".to_string(),
|
||||
format!("{}", err),
|
||||
code.span()?,
|
||||
Some(code.span()?),
|
||||
None,
|
||||
Vec::new(),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +95,13 @@ impl Command for Du {
|
||||
|
||||
let exclude = args.exclude.map_or(Ok(None), move |x| {
|
||||
Pattern::new(&x.item).map(Some).map_err(|e| {
|
||||
ShellError::SpannedLabeledError(e.msg.to_string(), "glob error".to_string(), x.span)
|
||||
ShellError::GenericError(
|
||||
e.msg.to_string(),
|
||||
"glob error".to_string(),
|
||||
Some(x.span),
|
||||
None,
|
||||
Vec::new(),
|
||||
)
|
||||
})
|
||||
})?;
|
||||
|
||||
@ -108,7 +114,13 @@ impl Command for Du {
|
||||
None => nu_glob::glob_with("*", GLOB_PARAMS),
|
||||
}
|
||||
.map_err(|e| {
|
||||
ShellError::SpannedLabeledError(e.msg.to_string(), "glob error".to_string(), tag)
|
||||
ShellError::GenericError(
|
||||
e.msg.to_string(),
|
||||
"glob error".to_string(),
|
||||
Some(tag),
|
||||
None,
|
||||
Vec::new(),
|
||||
)
|
||||
})?
|
||||
.filter(move |p| {
|
||||
if include_files {
|
||||
|
@ -87,10 +87,12 @@ impl Command for Kill {
|
||||
left_span: call
|
||||
.get_named_arg("force")
|
||||
.ok_or_else(|| {
|
||||
ShellError::SpannedLabeledError(
|
||||
ShellError::GenericError(
|
||||
"Flag error".into(),
|
||||
"flag force not found".into(),
|
||||
call.head,
|
||||
Some(call.head),
|
||||
None,
|
||||
Vec::new(),
|
||||
)
|
||||
})?
|
||||
.span,
|
||||
@ -98,10 +100,12 @@ impl Command for Kill {
|
||||
right_span: span(&[
|
||||
call.get_named_arg("signal")
|
||||
.ok_or_else(|| {
|
||||
ShellError::SpannedLabeledError(
|
||||
ShellError::GenericError(
|
||||
"Flag error".into(),
|
||||
"flag signal not found".into(),
|
||||
call.head,
|
||||
Some(call.head),
|
||||
None,
|
||||
Vec::new(),
|
||||
)
|
||||
})?
|
||||
.span,
|
||||
|
@ -36,9 +36,12 @@ impl Command for KeybindingsListen {
|
||||
Ok(v) => Ok(v.into_pipeline_data()),
|
||||
Err(e) => {
|
||||
terminal::disable_raw_mode()?;
|
||||
Err(ShellError::LabeledError(
|
||||
Err(ShellError::GenericError(
|
||||
"Error with input".to_string(),
|
||||
e.to_string(),
|
||||
"".to_string(),
|
||||
None,
|
||||
Some(e.to_string()),
|
||||
Vec::new(),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user