diff --git a/crates/nu-cmd-dataframe/src/dataframe/eager/to_avro.rs b/crates/nu-cmd-dataframe/src/dataframe/eager/to_avro.rs index bdf415ee38..ad442d073e 100644 --- a/crates/nu-cmd-dataframe/src/dataframe/eager/to_avro.rs +++ b/crates/nu-cmd-dataframe/src/dataframe/eager/to_avro.rs @@ -65,7 +65,8 @@ fn get_compression(call: &Call) -> Result, ShellError> { "deflate" => Ok(Some(AvroCompression::Deflate)), _ => Err(ShellError::IncorrectValue { msg: "compression must be one of deflate or snappy".to_string(), - span, + val_span: span, + call_span: span, }), } } else { diff --git a/crates/nu-command/src/conversions/into/int.rs b/crates/nu-command/src/conversions/into/int.rs index f03c8e36c1..d10778728d 100644 --- a/crates/nu-command/src/conversions/into/int.rs +++ b/crates/nu-command/src/conversions/into/int.rs @@ -252,7 +252,10 @@ fn action(input: &Value, args: &Arguments, span: Span) -> Value { Value::Int { val: 0, span } } } - Value::Date { val, .. } => { + Value::Date { + val, + span: val_span, + } => { if val < &FixedOffset::east_opt(0) .expect("constant") @@ -267,7 +270,8 @@ fn action(input: &Value, args: &Arguments, span: Span) -> Value { Value::Error { error: Box::new(ShellError::IncorrectValue { msg: "DateTime out of range for timestamp: 1677-09-21T00:12:43Z to 2262-04-11T23:47:16".to_string(), - span + val_span: *val_span, + call_span: span, }), } } else { diff --git a/crates/nu-command/src/strings/str_/replace.rs b/crates/nu-command/src/strings/str_/replace.rs index 4bd354dde2..174b0f08a2 100644 --- a/crates/nu-command/src/strings/str_/replace.rs +++ b/crates/nu-command/src/strings/str_/replace.rs @@ -275,7 +275,8 @@ fn action( Err(e) => Value::Error { error: Box::new(ShellError::IncorrectValue { msg: format!("Regex error: {e}"), - span: find.span, + val_span: find.span, + call_span: head, }), }, } diff --git a/crates/nu-protocol/src/shell_error.rs b/crates/nu-protocol/src/shell_error.rs index 2f9acb07d3..9dbdce4ab4 100644 --- a/crates/nu-protocol/src/shell_error.rs +++ b/crates/nu-protocol/src/shell_error.rs @@ -114,7 +114,9 @@ pub enum ShellError { IncorrectValue { msg: String, #[label = "{msg}"] - span: Span, + val_span: Span, + #[label = "encountered here"] + call_span: Span, }, /// This value cannot be used with this operator.