tsk-78: Updating returned error on converting ostring to string #87

Merged
kdeng00 merged 2 commits from tsk-78 into main 2025-10-23 16:52:27 -04:00
Showing only changes of commit 15c40d1596 - Show all commits
+15 -1
View File
@@ -1,6 +1,20 @@
pub fn o_to_string(val: &std::ffi::OsString) -> Result<std::string::String, std::io::Error> {
match val.clone().into_string() {
Ok(value) => Ok(value),
Err(_) => Err(std::io::Error::other(String::from("Error"))),
Err(err) => match err.into_string() {
Ok(res) => {
Err(std::io::Error::other(res.to_string()))
}
Err(err) => {
match err.to_str() {
Some(err) => {
Err(std::io::Error::other(err))
}
None => {
Err(std::io::Error::other("Undefined error"))
}
}
}
}
}
}