From b7ea7de13684c4cf7bd6cb6216a5f21d65df6ce5 Mon Sep 17 00:00:00 2001 From: Bryan Bell Date: Thu, 10 Sep 2015 21:31:58 -0700 Subject: [PATCH] Improve err msg when failing to output png Before on at least Linux the following failure is hard to root cause: [~/servo] ./target/debug/servo -o tmp.png ./tests/html/lipsum.html thread '
' panicked at 'assertion failed: res.is_ok()', .../compositor.rs:1508 thread '
' panicked at 'You should have disposed of the pixmap...', .../rust-layers/.../surface.rs:166 Now: [~/servo] ./target/debug/servo -o tmp.png ./tests/html/lipsum.html thread '
' panicked at 'Error writing png: Permission denied (os error 13)', .../compositor.rs:1508 thread '
' panicked at 'You should have disposed of the pixmap properly with destroy()! This pixmap will leak!', .../rust-layers/.../surface.rs:166 --- components/compositing/compositor.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index b5dfd8d4efb..187ee613628 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -1505,7 +1505,7 @@ impl IOCompositor { let mut img = self.draw_png(framebuffer_ids, texture_ids, width, height); let path = opts::get().output_file.as_ref().unwrap(); let res = png::store_png(&mut img, &path); - assert!(res.is_ok()); + assert!(res.is_ok(), format!("Error writing png: {}", res.unwrap_err())); None } };