silx-kit / h5web

React components for data visualization and exploration
https://h5web.panosc.eu/
MIT License
165 stars 17 forks source link

Propagate and improve handling of HDF5 errors #1586

Closed axelboc closed 4 months ago

axelboc commented 4 months ago

Sorry for the spam, GitHub is acting up. Pushing branches no longer triggers the CI. Even when I trigger the Lint & Test workflow manually, it stays "queued" indefinitely...

Fix #1570

Thanks to @bmaranville and h5wasm@0.7.2, we can now configure the HDF5 library to throw errors instead of just logging them to the console with console.error. This will hopefully help surface bugs much faster (like the one fixed in #1568).

Another benefit is that we can now take advantage of the propagated errors when it makes sense, like when a compression plugin is not supported, instead of trying to detect the situation ahead of time.

Summary of changes:

Of course, we might uncover other HDF5 errors that we'll need to handle more specifically; this just provides robust foundations. I'm also planning to wrap other h5wasm calls with try/catch (like when reading attributes) in my next PR.

Filter not registered

With dataset sz3 in filters.h5:

Screenshot 2024-03-01 at 11-59-22 H5Web

Screenshot 2024-03-01 at 11-59-12 H5Web

Fallback error

Same file as above, but after commenting out the detection of filter-related errors.

Screenshot 2024-03-01 at 11-57-53 H5Web

No more error for fcidecomp dataset

Before/after screenshots that show that our attempt at predicting when a filter was not supported was causing false positives:

Screenshot 2024-03-01 120023

Screenshot 2024-03-01 at 11-59-41 H5Web

axelboc commented 4 months ago

Phew, the CI unblocked itself and is passing now. 😌