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