Cache icon indicating copy to clipboard operation
Cache copied to clipboard

Fixed AsyncStorage `exists` not throwing errors

Open kitwtnb opened this issue 1 year ago • 4 comments
trafficstars

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.

kitwtnb avatar May 27 '24 04:05 kitwtnb

Hi @kitwtnb,

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

3lvis avatar Jun 04 '24 19:06 3lvis

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?

kitwtnb avatar Jun 05 '24 04:06 kitwtnb

Can anyone else verify if this breaks anything for them?

3lvis avatar Jun 19 '24 07:06 3lvis

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

kitwtnb avatar Jul 13 '24 07:07 kitwtnb