diff options
author | David Tolnay <dtolnay@chromium.org> | 2019-02-12 17:51:26 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-02-20 08:20:02 -0800 |
commit | b4bd00fdad094b16c785b8ead9f92d68264f5fb4 (patch) | |
tree | 540ad033c789aa08a1ffed17e9c161df331600d2 /devices/src/proxy.rs | |
parent | 0373b9f154b5ec1894138b7c10ad495fcce7b64f (diff) | |
download | crosvm-b4bd00fdad094b16c785b8ead9f92d68264f5fb4.tar crosvm-b4bd00fdad094b16c785b8ead9f92d68264f5fb4.tar.gz crosvm-b4bd00fdad094b16c785b8ead9f92d68264f5fb4.tar.bz2 crosvm-b4bd00fdad094b16c785b8ead9f92d68264f5fb4.tar.lz crosvm-b4bd00fdad094b16c785b8ead9f92d68264f5fb4.tar.xz crosvm-b4bd00fdad094b16c785b8ead9f92d68264f5fb4.tar.zst crosvm-b4bd00fdad094b16c785b8ead9f92d68264f5fb4.zip |
error: Print errors using Display impl
I have been running into Debug-printed error messages too often and needing to look up in the source code each level of nested errors to find out from the comment on the error variant what the short name of the variant means in human terms. Worse, many errors (like the one shown below) already had error strings written but were being printed from the calling code in the less helpful Debug representation anyway. Before: [ERROR:src/main.rs:705] The architecture failed to build the vm: NoVarEmpty After: [ERROR:src/main.rs:705] The architecture failed to build the vm: /var/empty doesn't exist, can't jail devices. TEST=cargo check --all-features TEST=FEATURES=test emerge-amd64-generic crosvm Change-Id: I77122c7d6861b2d610de2fff718896918ab21e10 Reviewed-on: https://chromium-review.googlesource.com/1469225 Commit-Ready: David Tolnay <dtolnay@chromium.org> Tested-by: David Tolnay <dtolnay@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Diffstat (limited to 'devices/src/proxy.rs')
-rw-r--r-- | devices/src/proxy.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/devices/src/proxy.rs b/devices/src/proxy.rs index 907f33c..4bc3405 100644 --- a/devices/src/proxy.rs +++ b/devices/src/proxy.rs @@ -72,7 +72,7 @@ fn child_proc(sock: UnixDatagram, device: &mut BusDevice) { let cmd = match sock.recv() { Ok(cmd) => cmd, Err(err) => { - error!("child device process failed recv: {:?}", err); + error!("child device process failed recv: {}", err); break; } }; @@ -108,7 +108,7 @@ fn child_proc(sock: UnixDatagram, device: &mut BusDevice) { } }; if let Err(e) = res { - error!("child device process failed send: {:?}", e); + error!("child device process failed send: {}", e); } } } @@ -175,15 +175,15 @@ impl ProxyDevice { let res = self.sock.send(&cmd); if let Err(e) = res { error!( - "failed write to child device process {}: {:?}", - self.debug_label, e + "failed write to child device process {}: {}", + self.debug_label, e, ); }; match self.sock.recv() { Err(e) => { error!( - "failed read from child device process {}: {:?}", - self.debug_label, e + "failed read from child device process {}: {}", + self.debug_label, e, ); None } |