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

merged 1 commit into from Oct 17, 2012


None yet

2 participants


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 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