Skip to content

Commit c5cc815

Browse files
authored
Increase vibisility into the "unknown errno" (#37)
We don't know what the underlying error is and that's scary.
1 parent 614886c commit c5cc815

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/sys.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,14 @@ use serde::{Deserialize, Serialize};
1919
/// negative, and the result of the function as-is otherwise.
2020
fn check_err(num: libc::c_long) -> Result<libc::c_long> {
2121
if num < 0 {
22-
return Err(Error::new(Errno::from_i32(num.try_into()?)));
22+
match Errno::from_i32(num.try_into()?) {
23+
Errno::UnknownErrno => {
24+
bail!("unknown errno: {}", num);
25+
}
26+
err => {
27+
return Err(Error::new(err));
28+
}
29+
}
2330
}
2431
Ok(num)
2532
}

0 commit comments

Comments
 (0)