std: Stablize io::ErrorKind
This commit stabilizes the `ErrorKind` enumeration which is consumed by and generated by the `io::Error` type. The purpose of this type is to serve as a cross-platform namespace to categorize errors into. Two specific issues are addressed as part of this stablization: * The naming of each variant was scrutinized and some were tweaked. An example is how `FileNotFound` was renamed to simply `NotFound`. These names should not show either a Unix or Windows bias and the set of names is intended to grow over time. For now the names will likely largely consist of those errors generated by the I/O APIs in the standard library. * The mapping of OS error codes onto kinds has been altered. Coalescing no longer occurs (multiple error codes become one kind). It is intended that each OS error code, if bound, corresponds to only one `ErrorKind`. The current set of error kinds was expanded slightly to include some networking errors. This commit also adds a `raw_os_error` function which returns an `Option<i32>` to extract the underlying raw error code from the `Error`.
This commit is contained in:
parent
12cb7c6a28
commit
dedac5eb3c
10 changed files with 83 additions and 52 deletions
|
@ -668,7 +668,7 @@ mod tests {
|
|||
#[test]
|
||||
fn test_process_output_fail_to_start() {
|
||||
match Command::new("/no-binary-by-this-name-should-exist").output() {
|
||||
Err(e) => assert_eq!(e.kind(), ErrorKind::FileNotFound),
|
||||
Err(e) => assert_eq!(e.kind(), ErrorKind::NotFound),
|
||||
Ok(..) => panic!()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue