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)?;
|
let lhs = eval_expression(engine_state, stack, expr)?;
|
||||||
match lhs {
|
match lhs {
|
||||||
Value::Bool { val, .. } => Ok(Value::bool(!val, expr.span)),
|
Value::Bool { val, .. } => Ok(Value::bool(!val, expr.span)),
|
||||||
_ => Err(ShellError::TypeMismatch {
|
other => Err(ShellError::TypeMismatch {
|
||||||
err_message: "bool".to_string(),
|
err_message: format!("expected bool, found {}", other.get_type()),
|
||||||
span: expr.span,
|
span: expr.span,
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user