mirror of
https://github.com/nushell/nushell.git
synced 2025-08-13 11:07:47 +02:00
Fix unsupported type message for some math related commands (#4672)
* Fix unsupported type message of some math related commands * changing the error form for UnsupportedInput * cargo fmt
This commit is contained in:
@ -62,9 +62,12 @@ fn abs_helper(val: Value, head: Span) -> Value {
|
||||
val: val.abs(),
|
||||
span,
|
||||
},
|
||||
_ => Value::Error {
|
||||
other => Value::Error {
|
||||
error: ShellError::UnsupportedInput(
|
||||
String::from("Only numerical values are supported"),
|
||||
format!(
|
||||
"Only numerical values are supported, input type: {:?}",
|
||||
other.get_type()
|
||||
),
|
||||
head,
|
||||
),
|
||||
},
|
||||
|
@ -53,7 +53,10 @@ fn operate(value: Value, head: Span) -> Value {
|
||||
},
|
||||
other => Value::Error {
|
||||
error: ShellError::UnsupportedInput(
|
||||
String::from("Only numerical values are supported"),
|
||||
format!(
|
||||
"Only numerical values are supported, input type: {:?}",
|
||||
other.get_type()
|
||||
),
|
||||
other.span().unwrap_or(head),
|
||||
),
|
||||
},
|
||||
|
@ -53,7 +53,10 @@ fn operate(value: Value, head: Span) -> Value {
|
||||
},
|
||||
other => Value::Error {
|
||||
error: ShellError::UnsupportedInput(
|
||||
String::from("Only numerical values are supported"),
|
||||
format!(
|
||||
"Only numerical values are supported, input type: {:?}",
|
||||
other.get_type()
|
||||
),
|
||||
other.span().unwrap_or(head),
|
||||
),
|
||||
},
|
||||
|
@ -94,7 +94,10 @@ fn operate(value: Value, head: Span, precision: Option<i64>) -> Value {
|
||||
Value::Int { .. } => value,
|
||||
other => Value::Error {
|
||||
error: ShellError::UnsupportedInput(
|
||||
String::from("Only numerical values are supported"),
|
||||
format!(
|
||||
"Only numerical values are supported, input type: {:?}",
|
||||
other.get_type()
|
||||
),
|
||||
other.span().unwrap_or(head),
|
||||
),
|
||||
},
|
||||
|
@ -62,7 +62,10 @@ fn operate(value: Value, head: Span) -> Value {
|
||||
}
|
||||
other => Value::Error {
|
||||
error: ShellError::UnsupportedInput(
|
||||
String::from("Only numerical values are supported"),
|
||||
format!(
|
||||
"Only numerical values are supported, input type: {:?}",
|
||||
other.get_type()
|
||||
),
|
||||
other.span().unwrap_or(head),
|
||||
),
|
||||
},
|
||||
|
Reference in New Issue
Block a user