Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

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

bshelton229
Copy link
Contributor

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.

@paulirish
Copy link
Collaborator

legit.

wfm.

paulirish added a commit that referenced this pull request Oct 17, 2012
Catch exceptions when saving to localStorage, which should catch over quota errors.
@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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants