Created
March 17, 2012 22:12
-
-
Save akgupta/2065777 to your computer and use it in GitHub Desktop.
handle quota exceeded error in local storage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
module.$localStorage[key] = serializer(value); | |
} catch(e) { | |
if(e.name === 'QUOTA_EXCEEDED_ERR') { | |
// reset to make space | |
module.reset(); | |
module.$localStorage[key] = serializer(value); | |
} else { | |
module.localStorageAvailable = false; | |
$log.error("Local storage write failure - " + e); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment