Auto merge of #7602 - bjwbell:improve_err_msg_when_writing_png, r=pcwalton

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

r? @mbrubeck

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7602)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-09-10 23:55:41 -06:00
commit eb556c1ce6

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
}
};