Make error reporting directory configurable

master
Sven Slootweg 7 years ago
parent af10fd8d63
commit 0c7bd699eb

@ -5,5 +5,8 @@
"listLimit": 100,
"pasteInterval": 1
}
},
"errors": {
"directory": "./errors"
}
}

@ -2,13 +2,14 @@
'use strict';
const errorReporter = require("./src/error-reporting");
const config = require("./config.json");
const path = require("path");
const errorReporter = require("./src/error-reporting")(path.join(__dirname, config.errors.directory));
const express = require("express");
const expressWs = require("express-ws");
const config = require("./config.json");
const clientStore = require("./src/client-store")();
const scraper = require("./src/scraper")({

@ -4,11 +4,10 @@ const path = require("path");
const reportErrors = require("report-errors");
const mkdirp = require("mkdirp");
let errorPath = path.join(__dirname, "../errors");
module.exports = function(errorPath) {
mkdirp.sync(errorPath);
mkdirp.sync(errorPath);
module.exports = reportErrors(errorPath, {
module.exports = reportErrors(errorPath, {
doNotCrash: true,
handler: (error, context) => {
console.error("Unhandled error", error.stack);
@ -17,4 +16,5 @@ module.exports = reportErrors(errorPath, {
process.exit(1);
}
}
});
});
};

Loading…
Cancel
Save