mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 22:50:14 +02:00
Convert more ShellError variants to named fields (#11222)
# Description Convert errors to named fields: * NeedsPositiveValue * MissingConfigValue * UnsupportedConfigValue * DowncastNotPossible * NonUtf8Custom * NonUtf8 * DidYouMeanCustom * DidYouMean * ReadingFile * RemoveNotPossible * ChangedModifiedTimeNotPossible * ChangedAccessTimeNotPossible Part of #10700
This commit is contained in:
@ -145,10 +145,10 @@ fn from_csv(
|
||||
let unicode_sep = u32::from_str_radix(&sep, 16);
|
||||
char::from_u32(unicode_sep.unwrap_or(b'\x1f' as u32)).unwrap_or(',')
|
||||
} else {
|
||||
return Err(ShellError::NonUtf8Custom(
|
||||
"separator should be a single char or a 4-byte unicode".to_string(),
|
||||
call.span(),
|
||||
));
|
||||
return Err(ShellError::NonUtf8Custom {
|
||||
msg: "separator should be a single char or a 4-byte unicode".into(),
|
||||
span: call.span(),
|
||||
});
|
||||
}
|
||||
}
|
||||
None => ',',
|
||||
|
@ -390,7 +390,7 @@ fn to_xml(
|
||||
let s = if let Ok(s) = String::from_utf8(b) {
|
||||
s
|
||||
} else {
|
||||
return Err(ShellError::NonUtf8(head));
|
||||
return Err(ShellError::NonUtf8 { span: head });
|
||||
};
|
||||
Ok(Value::string(s, head).into_pipeline_data())
|
||||
})
|
||||
|
Reference in New Issue
Block a user