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