Pantry
Pantry copied to clipboard
Packing and unpacking should throw errors with informative messages
Some things to think about:
- Should
pack
with some property that isn't supported throw an error? - Should
unpack
when a mismatch exists (property with no stored key? extra key that doesn't correspond to a property) throw an error?
I'm actually not 100% on this throwing errors to the end user anymore. Is there a high enough chance of failure that we should make everyone jump through the error checking loop every time they want to store or retrieve data?
It might be worth throwing when packing, since it's pretty important to ensure that the user knows that the data will not be available in the future. For the unpack returning an optional should suffice, and it would make the retrieval less of a burden for the user.