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 '<main>' panicked at 'assertion failed: res.is_ok()', .../compositor.rs:1508
    thread '<main>' 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 '<main>' panicked at 'Error writing png: Permission
    denied (os error 13)', .../compositor.rs:1508
    thread '<main>' panicked at 'You should have disposed of the pixmap
    properly with destroy()! This pixmap will leak!', .../rust-layers/.../surface.rs:166
This commit is contained in:
Bryan Bell 2015-09-10 21:31:58 -07:00
parent 4e69f301e1
commit b7ea7de136

View file

@ -1505,7 +1505,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
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
}
};