hyperoslo / Cache

:package: Nothing but Cache.
Other
2.96k stars 335 forks source link

Fixed AsyncStorage `exists` not throwing errors #325

Open kitwtnb opened 3 months ago

kitwtnb commented 3 months ago

Current existsObject() returns true or throw error, not returning false.
As per StorageAware, existsObject() should not throw an error.
Fix existsObject() to return false instead of error.

3lvis commented 3 months ago

Hi @kitwtnb,

Would you be so kind on adding a tests that reproduces the error as well to avoid regressions?

kitwtnb commented 3 months ago

Changed Result<Bool, Error> to Bool and removed throws.
So we could express by type that the previous problem does not regression.

Do I need to test separately from these?

3lvis commented 2 months ago

Can anyone else verify if this breaks anything for them?

kitwtnb commented 1 month ago

I understand what you are trying to say.

This test originally reproduced the problem.
I expect it to throw an Error instead of false if the object does not exist.
https://github.com/hyperoslo/Cache/pull/325/files#diff-360238a58739325a7ce97d0a648b466797db4442b6cae0592f1bb2e26c0f97d7L90