Return after rejecting, catch and log
This commit is contained in:
parent
82f179b07c
commit
cd1f5fd04a
1 changed files with 7 additions and 1 deletions
|
@ -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();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue