json parse exception handling
This commit is contained in:
@@ -7,12 +7,10 @@ var Neeto = Neeto || {};
|
||||
var IEOrEdge = document.documentMode || /Edge/.test(navigator.userAgent);
|
||||
|
||||
if(!IEOrEdge && (window.crypto && window.crypto.subtle)) {
|
||||
console.log("Using webcrypto");
|
||||
Neeto.crypto = new SNCryptoWeb();
|
||||
} else {
|
||||
console.log("Using CryptoJS");
|
||||
Neeto.crypto = new SNCryptoJS();
|
||||
}
|
||||
Neeto.crypto = new SNCryptoJS();
|
||||
|
||||
angular.module('app.frontend', [
|
||||
'ui.router',
|
||||
|
||||
@@ -27,7 +27,12 @@ class Item {
|
||||
return this.content;
|
||||
}
|
||||
|
||||
return JSON.parse(this.content);
|
||||
try {
|
||||
return JSON.parse(this.content);
|
||||
} catch (e) {
|
||||
console.log("Error parsing json", e);
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
updateFromJSON(json) {
|
||||
|
||||
@@ -566,7 +566,7 @@ angular.module('app.frontend')
|
||||
item.content = Neeto.crypto.base64Decode(item.content.substring(3, item.content.length))
|
||||
}
|
||||
} catch (e) {
|
||||
console.log("Error decrypting item", item);
|
||||
console.log("Error decrypting item", item, e);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user