Wrap localStorage API Access in try-catch (#1241)

This commit is contained in:
Shriram Balaji 2020-04-07 15:39:37 +05:30 committed by GitHub
parent 2cc1105ff5
commit 22160f50d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 12 deletions

View file

@ -81,8 +81,12 @@ export class TopErrorBoundary extends React.Component<
{t("errorSplash.clearCanvasMessage")}
<button
onClick={() => {
localStorage.clear();
window.location.reload();
try {
localStorage.clear();
window.location.reload();
} catch (error) {
console.error(error);
}
}}
>
{t("errorSplash.clearCanvasMessage_button")}