forked from extern/nushell
CantConvert improvements (#4926)
* CantConvert improvements * cargo fmt
This commit is contained in:
@ -112,6 +112,16 @@ pub enum ShellError {
|
||||
#[diagnostic(code(nu::shell::cant_convert), url(docsrs))]
|
||||
CantConvert(String, String, #[label("can't convert {1} to {0}")] Span),
|
||||
|
||||
// Identical to above, but with help
|
||||
#[error("Can't convert to {0}.")]
|
||||
#[diagnostic(code(nu::shell::cant_convert), url(docsrs), help("{3}"))]
|
||||
CantConvertWithHelp(
|
||||
String,
|
||||
String,
|
||||
#[label("can't convert {1} to {0}")] Span,
|
||||
String,
|
||||
),
|
||||
|
||||
#[error("{0} is not representable as a string.")]
|
||||
#[diagnostic(
|
||||
code(nu::shell::env_var_not_a_string),
|
||||
|
@ -16,7 +16,7 @@ impl Value {
|
||||
match self {
|
||||
Value::Int { val, .. } => Ok(*val),
|
||||
x => Err(ShellError::CantConvert(
|
||||
"rf64".into(),
|
||||
"i64".into(),
|
||||
x.get_type().to_string(),
|
||||
self.span()?,
|
||||
)),
|
||||
|
Reference in New Issue
Block a user