Merge pull request #976 from bndbsh/save-error

Improve error messages for save
This commit is contained in:
Jonathan Turner 2019-11-17 14:58:55 +13:00 committed by GitHub
commit 9dfc647386
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -19,8 +19,8 @@ macro_rules! process_string {
}
_ => {
break $scope Err(ShellError::labeled_error(
"Save could not successfully save",
"unexpected data during save",
"Save requires string data",
"consider converting data to string (see `help commands`)",
$name_tag,
));
}
@ -214,9 +214,9 @@ fn save(
match content {
Ok(save_data) => match std::fs::write(full_path, save_data) {
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),
}
};