While the source of the error is no doubt the constraints of the environment under which the code is running, it would be nice if certain errors might be skipped. There is no date-time that must be read from a \005SummaryInformation stream.
To note, this only fails in WASM I've found. I have separated functions to test locally like so:
#[wasm_bindgen(js_name = "getProductInfo")]
pub fn get_product_info(data: &[u8]) -> Result<ProductInfo, JsValue> {
let cursor = Cursor::new(data);
console_log!("opening package from {} bytes", data.len());
let info = read_product_info(cursor).unwrap_throw();
Ok(info)
}
pub fn read_product_info<R>(data: R) -> Result<ProductInfo, Box<dyn Error + Send + Sync>>
where
R: Read + Seek,
{
let mut package = Package::open(data)?;
// ...
}
Calling read_product_info locally works fine. This is just for context, though; again, I realize the source of the underlying problem isn't here: I'm just questioning whether failing to read some data should be strictly fatal.
I'm using a
Cursor
to read from an in-memory buffer usingPackage::open
, but found this will err in WASM:While the source of the error is no doubt the constraints of the environment under which the code is running, it would be nice if certain errors might be skipped. There is no date-time that must be read from a
\005SummaryInformation
stream.To note, this only fails in WASM I've found. I have separated functions to test locally like so:
Calling
read_product_info
locally works fine. This is just for context, though; again, I realize the source of the underlying problem isn't here: I'm just questioning whether failing to read some data should be strictly fatal.