Commit eb232c72 authored by Mohamed, Fawzi Roberto (fawzi)'s avatar Mohamed, Fawzi Roberto (fawzi)
Browse files

avoid stopping on invalid jsons

parent a8e2557a
...@@ -155,7 +155,12 @@ module.exports = function(config, models){ ...@@ -155,7 +155,12 @@ module.exports = function(config, models){
shortPath = "private/" shortPath = "private/"
shortPath += partialPath shortPath += partialPath
fs.readFile(path, 'utf8', function(err, contents) { 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; var title, authors, description;
try { try {
title = tut["cells"][0]["title"]; title = tut["cells"][0]["title"];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment