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
Branches
Tags
No related merge requests found
...@@ -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"];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment