json parse exception handling

This commit is contained in:
Mo Bitar
2017-01-15 18:10:10 -06:00
parent 32b709c689
commit bbedad0fc5
3 changed files with 8 additions and 5 deletions

View File

@@ -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) {