mirror of
https://github.com/nushell/nushell
synced 2024-12-27 13:33:16 +00:00
Merge pull request #976 from bndbsh/save-error
Improve error messages for save
This commit is contained in:
commit
9dfc647386
1 changed files with 4 additions and 4 deletions
|
@ -19,8 +19,8 @@ macro_rules! process_string {
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
break $scope Err(ShellError::labeled_error(
|
break $scope Err(ShellError::labeled_error(
|
||||||
"Save could not successfully save",
|
"Save requires string data",
|
||||||
"unexpected data during save",
|
"consider converting data to string (see `help commands`)",
|
||||||
$name_tag,
|
$name_tag,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -214,9 +214,9 @@ fn save(
|
||||||
match content {
|
match content {
|
||||||
Ok(save_data) => match std::fs::write(full_path, save_data) {
|
Ok(save_data) => match std::fs::write(full_path, save_data) {
|
||||||
Ok(o) => o,
|
Ok(o) => o,
|
||||||
Err(e) => yield Err(ShellError::labeled_error(e.to_string(), "for command", name)),
|
Err(e) => yield Err(ShellError::labeled_error(e.to_string(), "IO error while saving", name)),
|
||||||
},
|
},
|
||||||
Err(e) => yield Err(ShellError::labeled_error(e.to_string(), "for command", name)),
|
Err(e) => yield Err(e),
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue