From f598e2583f73cc5e77b994f9ace027012852cd49 Mon Sep 17 00:00:00 2001 From: Endilie Yacop Sucipto Date: Wed, 27 Jun 2018 22:45:08 +0700 Subject: [PATCH] handle promise error & exit properly (#809) --- lib/build-files.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/build-files.js b/lib/build-files.js index bca51bcb8a4e..46b22639fbf3 100755 --- a/lib/build-files.js +++ b/lib/build-files.js @@ -33,5 +33,11 @@ if (!fs.existsSync(CWD + '/siteConfig.js')) { // generate all static html files const generate = require('./server/generate.js'); -generate(); -console.log("Site built successfully. Generated files in 'build' folder."); +generate() + .then(() => { + console.log("Site built successfully. Generated files in 'build' folder."); + }) + .catch(error => { + console.error(error); + process.exit(1); + });