Return after rejecting, catch and log

This commit is contained in:
Tim Schaub 2017-10-23 09:46:04 -06:00
parent 82f179b07c
commit cd1f5fd04a

View file

@ -246,8 +246,9 @@ function start(opts) {
startupPromises.push(new Promise(function(resolve, reject) {
fs.readFile(templateFile, function(err, content) {
if (err) {
console.error('Template not found:', err);
err = new Error('Template not found: ' + err.message);
reject(err);
return;
}
var compiled = handlebars.compile(content.toString());
@ -415,6 +416,11 @@ function start(opts) {
module.exports = function(opts) {
var running = start(opts);
running.startupPromise.catch(function(err) {
console.error(err.message);
process.exit(1);
});
process.on('SIGINT', function() {
process.exit();
});