try to catch QuotaExceededError

This commit is contained in:
Steven Hugg 2019-09-07 19:44:26 -04:00
parent 53669cd579
commit c3d792f82f
2 changed files with 10 additions and 4 deletions

View File

@ -148,7 +148,6 @@ TODO:
- allow "include graphics.asm" instead of "include project/graphics.asm"
- convert more stuff to Promises
- target ES6
- don't have to include bootstrap-tourist each time?
- don't have to include firebase always?
- squelch error msgs?
- test offline? (if window.firebase)

View File

@ -108,11 +108,13 @@ function requestPersistPermission() {
if (navigator.storage && navigator.storage.persist) {
navigator.storage.persist().then(persistent=>{
if (persistent) {
alertInfo("We asked your browser to persist local data, and it said yes.");
alertInfo("Your browser says you have unlimited persistent storage quota for this site. If you got an error while storing something, please try again.");
} else {
alertInfo("This browser may not persist local data. Are you in a private window?");
alertInfo("Your browser says your local files may not be persisted. Are you in a private window?");
}
});
} else {
alertInfo("Your browser doesn't support expanding the persistent storage quota.");
}
}
@ -1683,7 +1685,12 @@ function installErrorHandler() {
'exFatal': true
});
$.get("/error?msg=" + encodeURIComponent(msg), "text");
alertError(msg);
// storage quota full? (Chrome) try to expand it
if (msg.indexOf("QuotaExceededError") >= 0) {
requestPersistPermission();
} else {
alertError(msg);
}
}
_pause();
};