wasi-common: trace and convert error

this is a bug - the TODO was never resolved, even when the code to
implement it was added right below :)

tracing is already in the transitive deps via wiggle, so no extra
trouble there. tracing::debug is more appropriate than eprintln
This commit is contained in:
Pat Hickey
2020-08-17 17:20:16 -07:00
parent 30b9e69136
commit 19369142cb
3 changed files with 11 additions and 9 deletions

13
Cargo.lock generated
View File

@@ -2156,9 +2156,9 @@ dependencies = [
[[package]]
name = "tracing"
version = "0.1.16"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2e2a2de6b0d5cbb13fc21193a2296888eaab62b6044479aafb3c54c01c29fcd"
checksum = "6d79ca061b032d6ce30c660fded31189ca0b9922bf483cd70759f13a2d86786c"
dependencies = [
"cfg-if",
"log",
@@ -2168,9 +2168,9 @@ dependencies = [
[[package]]
name = "tracing-attributes"
version = "0.1.9"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0693bf8d6f2bf22c690fc61a9d21ac69efdbb894a17ed596b9af0f01e64b84b"
checksum = "1fe233f4227389ab7df5b32649239da7ebe0b281824b4e84b342d04d3fd8c25e"
dependencies = [
"proc-macro2",
"quote",
@@ -2179,9 +2179,9 @@ dependencies = [
[[package]]
name = "tracing-core"
version = "0.1.11"
version = "0.1.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94ae75f0d28ae10786f3b1895c55fe72e79928fd5ccdebb5438c75e93fec178f"
checksum = "db63662723c316b43ca36d833707cc93dff82a02ba3d7e354f342682cc8b3545"
dependencies = [
"lazy_static",
]
@@ -2326,6 +2326,7 @@ dependencies = [
"libc",
"log",
"thiserror",
"tracing",
"wig",
"wiggle",
"winapi",

View File

@@ -27,6 +27,7 @@ filetime = "0.2.7"
lazy_static = "1.4.0"
wig = { path = "wig", version = "0.19.0" }
wiggle = { path = "../wiggle", default-features = false, version = "0.19.0" }
tracing = "0.1.19"
[target.'cfg(unix)'.dependencies]
yanix = { path = "yanix", version = "0.19.0" }

View File

@@ -2,6 +2,7 @@
//! pointer or `usize`-sized data are excluded here, so this file only contains
//! fixed-size types, so it's host/target independent.
use crate::WasiCtx;
use tracing::debug;
wiggle::from_witx!({
witx: ["WASI/phases/snapshot/witx/wasi_snapshot_preview1.witx"],
@@ -19,9 +20,8 @@ impl wiggle::GuestErrorType for Errno {
impl types::GuestErrorConversion for WasiCtx {
fn into_errno(&self, e: wiggle::GuestError) -> Errno {
eprintln!("Guest error: {:?}", e);
// TODO proper error mapping
Errno::Inval
debug!("Guest error: {:?}", e);
e.into()
}
}