From eb232c724edffd9fbec6fd681661b1444c0b7895 Mon Sep 17 00:00:00 2001
From: Fawzi Mohamed <fawzi.mohamed@fhi-berlin.mpg.de>
Date: Mon, 3 Dec 2018 21:48:52 +0100
Subject: [PATCH] avoid stopping on invalid jsons

---
 app/filesWatcher.js | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/app/filesWatcher.js b/app/filesWatcher.js
index 447922b..21fed14 100644
--- a/app/filesWatcher.js
+++ b/app/filesWatcher.js
@@ -155,7 +155,12 @@ module.exports = function(config, models){
       shortPath = "private/"
     shortPath += partialPath
     fs.readFile(path, 'utf8', function(err, contents) {
-      const tut = JSON.parse(contents);
+      var tut = {}
+      try {
+        tut = JSON.parse(contents);
+      } catch (err) {
+        logger.warn(`json parse error for file ${path}: ${stringify(err)}`)
+      }
       var title, authors, description;
       try {
         title = tut["cells"][0]["title"];
-- 
GitLab