Browse Source

fix queries sometimes failing

pull/6/head
rozetko 2 years ago
parent
commit
d1d63e8823
  1. 8
      src/routes/tasks.ts

8
src/routes/tasks.ts

@ -31,8 +31,12 @@ async function getTasks(req, res) {
}
// TODO: read async
let data = fs.readFileSync(path.join(EXPORTED_PATH, item), 'utf8');
let status = JSON.parse(data);
resp.push(status);
try {
let status = JSON.parse(data);
resp.push(status);
} catch(e) {
console.log(`Cannot read file /exporter/${item}. if this error doesn't repeat, maybe the file is being updated at the moment`);
}
}
res.status(200).send(resp);

Loading…
Cancel
Save