Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Catch exceptions when saving to localStorage, which should catch over quota errors. #10

Merged
merged 1 commit into from Oct 17, 2012

Conversation

Projects
None yet
2 participants
Contributor

bshelton229 commented Oct 17, 2012

Added some exception handling around localStorage.setItem(), and optionally pass the exception to a cacheError() callback if defined. My use case is to catch any QUOTA_EXCEEDED_ERR exceptions, and to use the callback to selectively clean up some cached items in that event. I couldn't find a better way to check for over limit errors, I'm not sure if this is the best approach or not.

Collaborator

paulirish commented Oct 17, 2012

legit.

wfm.

@paulirish paulirish added a commit that referenced this pull request Oct 17, 2012

@paulirish paulirish Merge pull request #10 from bshelton229/feature/quota
Catch exceptions when saving to localStorage, which should catch over quota errors.
75733a4

@paulirish paulirish merged commit 75733a4 into SaneMethod:master Oct 17, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment