use abbreviated string instead of debug string for DatetimeParseErrors (#12517)

Resolves #12444. Prevents debug string from being printed out.

---------

Co-authored-by: sholderbach <sholderbach@users.noreply.github.com>
This commit is contained in:
pwygab
2024-04-17 05:19:03 +08:00
committed by GitHub
parent cc781a1ecd
commit 43814dcb0f
6 changed files with 32 additions and 20 deletions

View File

@ -153,9 +153,11 @@ fn format_helper(value: Value, formatter: &str, formatter_span: Span, head_span:
}
}
_ => Value::error(
ShellError::DatetimeParseError {
msg: value.to_debug_string(),
span: head_span,
ShellError::OnlySupportsThisInputType {
exp_input_type: "date, string (that represents datetime)".into(),
wrong_type: value.get_type().to_string(),
dst_span: head_span,
src_span: value.span(),
},
head_span,
),
@ -174,9 +176,11 @@ fn format_helper_rfc2822(value: Value, span: Span) -> Value {
}
}
_ => Value::error(
ShellError::DatetimeParseError {
msg: value.to_debug_string(),
span,
ShellError::OnlySupportsThisInputType {
exp_input_type: "date, string (that represents datetime)".into(),
wrong_type: value.get_type().to_string(),
dst_span: span,
src_span: val_span,
},
span,
),