summary refs log tree commit diff
path: root/devices/src/virtio/gpu/mod.rs
diff options
context:
space:
mode:
authorDavid Tolnay <dtolnay@chromium.org>2019-02-12 17:51:26 -0800
committerchrome-bot <chrome-bot@chromium.org>2019-02-20 08:20:02 -0800
commitb4bd00fdad094b16c785b8ead9f92d68264f5fb4 (patch)
tree540ad033c789aa08a1ffed17e9c161df331600d2 /devices/src/virtio/gpu/mod.rs
parent0373b9f154b5ec1894138b7c10ad495fcce7b64f (diff)
downloadcrosvm-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/virtio/gpu/mod.rs')
-rw-r--r--devices/src/virtio/gpu/mod.rs22
1 files changed, 11 insertions, 11 deletions
diff --git a/devices/src/virtio/gpu/mod.rs b/devices/src/virtio/gpu/mod.rs
index 8da15f5..c8d4dcd 100644
--- a/devices/src/virtio/gpu/mod.rs
+++ b/devices/src/virtio/gpu/mod.rs
@@ -365,14 +365,14 @@ impl Frontend {
                                 Ok(data_mem) => {
                                     resp = self.process_gpu_command(mem, cmd, Some(data_mem))
                                 }
-                                Err(e) => debug!("ctrl queue invalid data descriptor: {:?}", e),
+                                Err(e) => debug!("ctrl queue invalid data descriptor: {}", e),
                             }
                         }
                         None => resp = self.process_gpu_command(mem, cmd, None),
                     }
                     gpu_cmd = Some(cmd);
                 }
-                Err(e) => debug!("ctrl queue decode error: {:?}", e),
+                Err(e) => debug!("ctrl queue decode error: {}", e),
             }
         }
         if resp.is_err() {
@@ -402,7 +402,7 @@ impl Frontend {
                 // fence is complete.
                 match resp.encode(flags, fence_id, ctx_id, ret_desc_mem) {
                     Ok(l) => len = l,
-                    Err(e) => debug!("ctrl queue response encode error: {:?}", e),
+                    Err(e) => debug!("ctrl queue response encode error: {}", e),
                 }
 
                 if flags & VIRTIO_GPU_FLAG_FENCE != 0 {
@@ -505,14 +505,14 @@ impl Worker {
         {
             Ok(pc) => pc,
             Err(e) => {
-                error!("failed creating PollContext: {:?}", e);
+                error!("failed creating PollContext: {}", e);
                 return;
             }
         };
 
         if let Some(ref resource_bridge) = self.resource_bridge {
             if let Err(e) = poll_ctx.add(resource_bridge, Token::ResourceBridge) {
-                error!("failed to add resource bridge to PollContext: {:?}", e);
+                error!("failed to add resource bridge to PollContext: {}", e);
             }
         }
 
@@ -527,7 +527,7 @@ impl Worker {
             let events = match poll_ctx.wait_timeout(duration) {
                 Ok(v) => v,
                 Err(e) => {
-                    error!("failed polling for events: {:?}", e);
+                    error!("failed polling for events: {}", e);
                     break;
                 }
             };
@@ -722,7 +722,7 @@ impl VirtioDevice for Gpu {
         let exit_evt = match self.exit_evt.try_clone() {
             Ok(e) => e,
             Err(e) => {
-                error!("error cloning exit eventfd: {:?}", e);
+                error!("error cloning exit eventfd: {}", e);
                 return;
             }
         };
@@ -730,7 +730,7 @@ impl VirtioDevice for Gpu {
         let (self_kill_evt, kill_evt) = match EventFd::new().and_then(|e| Ok((e.try_clone()?, e))) {
             Ok(v) => v,
             Err(e) => {
-                error!("error creating kill EventFd pair: {:?}", e);
+                error!("error creating kill EventFd pair: {}", e);
                 return;
             }
         };
@@ -750,8 +750,8 @@ impl VirtioDevice for Gpu {
                     const UNDESIRED_CARDS: &[&str] = &["vgem", "pvr"];
                     let drm_card = match gpu_buffer::rendernode::open_device(UNDESIRED_CARDS) {
                         Ok(f) => f,
-                        Err(e) => {
-                            error!("failed to open card: {:?}", e);
+                        Err(()) => {
+                            error!("failed to open card");
                             return;
                         }
                     };
@@ -767,7 +767,7 @@ impl VirtioDevice for Gpu {
                     let display = match GpuDisplay::new(socket_path) {
                         Ok(c) => c,
                         Err(e) => {
-                            error!("failed to open display: {:?}", e);
+                            error!("failed to open display: {}", e);
                             return;
                         }
                     };