refactor errno_from_ioerror
This commit is contained in:
committed by
Jakub Konka
parent
ae836df42d
commit
c5339d01cf
11
src/error.rs
11
src/error.rs
@@ -1,5 +1,4 @@
|
|||||||
use crate::host;
|
use crate::host;
|
||||||
use crate::sys::errno_from_ioerror;
|
|
||||||
use failure::Fail;
|
use failure::Fail;
|
||||||
use std::convert::Infallible;
|
use std::convert::Infallible;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
@@ -254,3 +253,13 @@ impl fmt::Display for Error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn errno_from_ioerror(e: &std::io::Error) -> host::__wasi_errno_t {
|
||||||
|
match e.raw_os_error() {
|
||||||
|
Some(code) => crate::sys::errno_from_host(code),
|
||||||
|
None => {
|
||||||
|
log::debug!("Inconvertible OS error: {}", e);
|
||||||
|
host::__WASI_EIO
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -22,13 +22,3 @@ cfg_if! {
|
|||||||
compile_error!("wasi-common doesn't compile for this platform yet");
|
compile_error!("wasi-common doesn't compile for this platform yet");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn errno_from_ioerror(e: &std::io::Error) -> host::__wasi_errno_t {
|
|
||||||
match e.raw_os_error() {
|
|
||||||
Some(code) => errno_from_host(code),
|
|
||||||
None => {
|
|
||||||
log::debug!("Inconvertible OS error: {}", e);
|
|
||||||
host::__WASI_EIO
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user