don't error out when backend log does not exist yet, fixes #1977

This commit is contained in:
zadam
2021-05-25 21:03:00 +02:00
parent 5860b2eebb
commit 3c7232f427
4 changed files with 20 additions and 10 deletions

View File

@@ -7,7 +7,13 @@ const {LOG_DIR} = require('../../services/data_dir.js');
function getBackendLog() {
const file = `${LOG_DIR}/trilium-${dateUtils.localNowDate()}.log`;
return fs.readFileSync(file, 'utf8');
try {
return fs.readFileSync(file, 'utf8');
}
catch (e) {
// most probably the log file does not exist yet - https://github.com/zadam/trilium/issues/1977
return "";
}
}
module.exports = {