wh0 / nix-cache-view

in-browser .nar explorer
https://wh0.github.io/nix-cache-view/
MIT License
12 stars 1 forks source link

Display progress and errors #11

Closed wh0 closed 8 months ago

wh0 commented 1 year ago

Progress doesn't have to be very detailed. Big chunky steps like "download," "decompress," etc. are fine. I know we use stuff like fetch and single-call xz_dec_run which doesn't produce progress info.

Error display doesn't have to be fancy. Put a red div on screen maybe. The error stack should be fine, don't need custom error messages. Just so we don't have to open the developer console to see if something went wrong.

Currently we only have a catch (e) { console.error(e); } https://github.com/wh0/nix-cache-view/blob/1a5bba2d55272506ff2f7c6af27cf0bf92d79474/nar.html#L77

Oh, a warning: we transfer control of the main thread to the wasm decompressor, i.e. it's syncrhonous. So make sure to schedule a separate task to render the "decompressing" message before starting the decompression. Probably rigging up a line to await a requestAnimationFrame will suffice.