ponymail-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From humbed...@apache.org
Subject [2/2] incubator-ponymail git commit: only try to save data to localStorage, log if fail but don't crash
Date Tue, 06 Sep 2016 09:41:51 GMT
only try to save data to localStorage, log if fail but don't crash


Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/abac8d91
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/abac8d91
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/abac8d91

Branch: refs/heads/coffee-and-cake
Commit: abac8d911ddcf0b03793f18f8b3623442bf98cbb
Parents: a8cc75a
Author: Daniel Gruno <humbedooh@apache.org>
Authored: Tue Sep 6 11:40:53 2016 +0200
Committer: Daniel Gruno <humbedooh@apache.org>
Committed: Tue Sep 6 11:40:53 2016 +0200

----------------------------------------------------------------------
 site/js/coffee/localstorage.coffee | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/abac8d91/site/js/coffee/localstorage.coffee
----------------------------------------------------------------------
diff --git a/site/js/coffee/localstorage.coffee b/site/js/coffee/localstorage.coffee
index 0fcf25e..add99ab 100644
--- a/site/js/coffee/localstorage.coffee
+++ b/site/js/coffee/localstorage.coffee
@@ -36,7 +36,12 @@ catch e
 dbWrite = (key, value) ->
     ### Can we use localStorage? ###
     if pm_storage_available
-        return window.localStorage.setItem(key, value)
+        try
+            rv = window.localStorage.setItem(key, value)
+            return rv
+        catch e
+            console.log("Could not save data to DB: " + e)
+            return null
     else
         ### Guess not, fall back to (ineffective) global var ###
         pm_storage_globvar[key] = value


Mime
View raw message