schibsted / account-sdk-browser

Schibsted Account SDK for browsers
https://schibsted.github.io/account-sdk-browser/
MIT License
16 stars 11 forks source link

fix: ignore malformed session storage objects #243

Closed bukowskiadam closed 1 year ago

bukowskiadam commented 1 year ago

We get reports from readers that they see non-subscribers ads even when they are subscribers.

If you invoke monetization.hasAccess function and it fails to read from the cache because of the malformed JSON, then it does not request the API for the fresh response.

I don't know if that'll fix our problem, but I think it's better to make it even more bullet-proof.

Any idea what to do with the error? I just ignored it.

I didn't test that code locally - PR was made from Github UI

codecov[bot] commented 1 year ago

Codecov Report

Merging #243 (6ccddcd) into master (f59c262) will increase coverage by 0.00%. The diff coverage is 100.00%.

:exclamation: Current head 6ccddcd differs from pull request most recent head 4a3a36c. Consider uploading reports for the commit 4a3a36c to get more accurate results

@@           Coverage Diff           @@
##           master     #243   +/-   ##
=======================================
  Coverage   99.78%   99.79%           
=======================================
  Files          13       13           
  Lines         475      478    +3     
  Branches       97       96    -1     
=======================================
+ Hits          474      477    +3     
  Misses          1        1           
Impacted Files Coverage Δ
src/cache.js 100.00% <100.00%> (ø)

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more