mirror of
https://github.com/nushell/nushell.git
synced 2024-11-07 09:04:18 +01:00
make better error message for not
operator (#10507)
Fixes: #10476 After the change, the error message will be something like this: ```nushell ❯ not null Error: nu:🐚:type_mismatch × Type mismatch. ╭─[entry #11:1:1] 1 │ not null · ──┬─ · ╰── expected bool, found nothing ╰──── ```
This commit is contained in:
parent
feef612388
commit
d2f513da36
@ -331,8 +331,8 @@ pub fn eval_expression(
|
||||
let lhs = eval_expression(engine_state, stack, expr)?;
|
||||
match lhs {
|
||||
Value::Bool { val, .. } => Ok(Value::bool(!val, expr.span)),
|
||||
_ => Err(ShellError::TypeMismatch {
|
||||
err_message: "bool".to_string(),
|
||||
other => Err(ShellError::TypeMismatch {
|
||||
err_message: format!("expected bool, found {}", other.get_type()),
|
||||
span: expr.span,
|
||||
}),
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user