Skip to content
Snippets Groups Projects
Commit eb232c72 authored by Mohamed, Fawzi Roberto (fawzi)'s avatar Mohamed, Fawzi Roberto (fawzi)
Browse files

avoid stopping on invalid jsons

parent a8e2557a
No related branches found
No related tags found
No related merge requests found
......@@ -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"];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment