summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Kiessling <mittagessen@l.unchti.me>2011-11-29 16:55:48 +0100
committerBenjamin Kiessling <mittagessen@l.unchti.me>2011-11-29 16:55:48 +0100
commit9f699b4ed028796f37f2dc55218d432612354414 (patch)
tree4fd4f913d087d57d463755ed2f2dc6f5dcd0e414
parenta6d1c2506c88cea89409e664b7ef700bd740cb3d (diff)
Catch exception thrown by JSON.parse
-rw-r--r--model_fs.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/model_fs.js b/model_fs.js
index 14cb4b5..3e2af12 100644
--- a/model_fs.js
+++ b/model_fs.js
@@ -87,7 +87,11 @@ exports.rebuildFiles = function() {
var collectEvents = function(slideset) {
fs.readFile(path.join(__dirname, configuration.dir, slideset, configuration.events), function(err, data) {
if(err) { throw err; }
- var events = JSON.parse(data.toString());
+ try {
+ var events = JSON.parse(data.toString());
+ } catch(e) {
+ throw err;
+ }
if(events['type'] == 'text') {
setEvents(slideset, events['events'], function(err) {
if(err) { throw err; }