Skip to content

Commit 8186b01

Browse files
committed
render: Add more detail to InvalidZlibCompression
This allows us to see what's wrong when this error happens.
1 parent 2e8456c commit 8186b01

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

render/src/error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ pub enum Error {
1515
#[error("Unknown bitmap format")]
1616
UnknownType,
1717

18-
#[error("Invalid ZLIB compression")]
19-
InvalidZlibCompression,
18+
#[error("Invalid ZLIB compression: {0}")]
19+
InvalidZlibCompression(std::io::Error),
2020

2121
#[error("Invalid JPEG")]
2222
InvalidJpeg(#[from] jpeg_decoder::Error),

render/src/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ fn decompress_zlib(data: &[u8]) -> Result<Vec<u8>, Error> {
491491
let mut decoder = flate2::bufread::ZlibDecoder::new(data);
492492
decoder
493493
.read_to_end(&mut out_data)
494-
.map_err(|_| Error::InvalidZlibCompression)?;
494+
.map_err(Error::InvalidZlibCompression)?;
495495
out_data.shrink_to_fit();
496496
Ok(out_data)
497497
}

0 commit comments

Comments
 (0)