From 6b7f2b354203b3929a8dfc87050a41b4642dad46 Mon Sep 17 00:00:00 2001 From: Camilo Bravo Date: Mon, 13 Aug 2018 18:51:04 -0400 Subject: [PATCH] feat(errors): adds error handling that will terminate the node process. --- es5-autogenerated/index.js | 3 ++- es6/index.js | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/es5-autogenerated/index.js b/es5-autogenerated/index.js index e948063..305dd13 100644 --- a/es5-autogenerated/index.js +++ b/es5-autogenerated/index.js @@ -154,7 +154,8 @@ PrerenderSPAPlugin.prototype.apply = function (compiler) { }).catch(function (err) { PrerendererInstance.destroy(); console.error('[prerender-spa-plugin] Unable to prerender all routes!'); - throw err; + compilation.errors.push(new Error('[prerender-spa-plugin] Unable to prerender all routes!')); + done(); }); }; diff --git a/es6/index.js b/es6/index.js index bec07ef..be1c87e 100644 --- a/es6/index.js +++ b/es6/index.js @@ -143,8 +143,9 @@ PrerenderSPAPlugin.prototype.apply = function (compiler) { }) .catch(err => { PrerendererInstance.destroy() - console.error('[prerender-spa-plugin] Unable to prerender all routes!') - throw err + console.error('[prerender-spa-plugin] Unable to prerender all routes!'); + compilation.errors.push( new Error( '[prerender-spa-plugin] Unable to prerender all routes!' ) ); + done(); }) }