You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A KeyError is a built in python error that's thrown when a key is missing from a MutableMapping. In JavaScript, the equivalent behavior is to just return undefined when a key is missing. Making this change would remove a lot of the try/catch blocks from the core implementation and instead we would just call:
// Store returns 'undefined' instead of throwing custom error if chunk is missing.// Otherwise the store can throw any other error and it will propagate up.constchunk=awaitthis.store.get(ckey);if(!chunk){/* create the missing chunk */}else{/* decode the chunk */}
The text was updated successfully, but these errors were encountered:
This means that custom store implementations don't need to have zarrita as a dependency, and instead can explicitly return undefined when a key is missing.
After experimenting with this for a bit, I'm not sure what the "right" approach is here. We would need to be careful in handling the store internally (and this could bite us), but custom store implementations would be much more simple:
1.) return bytes if key in store.
2.) return undefined if not in store.
Adapted from: gzuidhof/zarr.js#69
A
KeyError
is a built in python error that's thrown when a key is missing from aMutableMapping
. In JavaScript, the equivalent behavior is to just returnundefined
when a key is missing. Making this change would remove a lot of thetry
/catch
blocks from the core implementation and instead we would just call:The text was updated successfully, but these errors were encountered: