forked from extern/nushell
Fix the panic running a bad alias (#1624)
This commit is contained in:
parent
0f7b270740
commit
ce0231049e
@ -68,7 +68,7 @@ impl PerItemCommand for AliasCommand {
|
|||||||
Ok(stream) if stream.is_empty() => {
|
Ok(stream) if stream.is_empty() => {
|
||||||
yield Err(ShellError::labeled_error(
|
yield Err(ShellError::labeled_error(
|
||||||
"Expected a block",
|
"Expected a block",
|
||||||
"each needs a block",
|
"alias needs a block",
|
||||||
tag,
|
tag,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
@ -79,12 +79,26 @@ impl PerItemCommand for AliasCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let errors = context.get_errors();
|
let errors = context.get_errors();
|
||||||
if let Some(error) = errors.first() {
|
if let Some(x) = errors.first() {
|
||||||
yield Err(error.clone());
|
//yield Err(error.clone());
|
||||||
|
yield Err(ShellError::labeled_error_with_secondary(
|
||||||
|
"Alias failed to run",
|
||||||
|
"alias failed to run",
|
||||||
|
tag.clone(),
|
||||||
|
x.to_string(),
|
||||||
|
tag
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
yield Err(e);
|
//yield Err(e);
|
||||||
|
yield Err(ShellError::labeled_error_with_secondary(
|
||||||
|
"Alias failed to run",
|
||||||
|
"alias failed to run",
|
||||||
|
tag.clone(),
|
||||||
|
e.to_string(),
|
||||||
|
tag
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user