Skip to content

Commit

Permalink
Don't error if storing markers in localstorage throws an error (#450)
Browse files Browse the repository at this point in the history
* Don't error if storing markers in localstorage throws an error

The bug on some versions of safari was caused by this - for reasons unknown it was throwing a quota exceeded error when we go to cache the markers.
The app appears to work without this in any case, so we just catch the error and log an informational message before carrying on, which fixes the safari issue.

* Add error to catch

* use angular-spinner from our cloned repo

---------

Co-authored-by: oscgonfer <[email protected]>
  • Loading branch information
timcowlishaw and oscgonfer authored Nov 20, 2023
1 parent bce8e5f commit f5b6afd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"angular-load": "~0.3.0",
"angular-material": "^1.1.9",
"angular-sanitize": "^1.7.0",
"angular-spinner": "~0.6.1",
"angular-spinner": "https://github.com/fablabbcn/bower-angular-spinner.git",
"angular-ui-router": "^1.0.17",
"angular-cookies": "^1.7.0",
"d3": "~3.5.5",
Expand Down
7 changes: 5 additions & 2 deletions src/app/core/api/device.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,11 @@
timestamp: new Date(),
data: data
};

$window.localStorage.setItem('smartcitizen.markers', JSON.stringify(obj) );
try {
$window.localStorage.setItem('smartcitizen.markers', JSON.stringify(obj) );
} catch (e) {
console.log("Could not store markers in localstorage. skipping...");
}
worldMarkers = obj.data;
}

Expand Down

0 comments on commit f5b6afd

Please sign in to comment.