From 1a03ee15b33f0c7be89b524e4911cf4b912e76d6 Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Tue, 20 Jun 2017 20:33:54 +0200 Subject: [PATCH] build: properly fail prerender task (#5235) * The prerender script that runs on the CI did not exit with a proper error-code when the `renderModuleFactory` failed due to errors like in #5233 --- src/universal-app/prerender.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/universal-app/prerender.ts b/src/universal-app/prerender.ts index 9b347978c1a..cca64e72d97 100644 --- a/src/universal-app/prerender.ts +++ b/src/universal-app/prerender.ts @@ -13,4 +13,9 @@ const result = renderModuleFactory(KitchenSinkServerModuleNgFactory, { document: readFileSync(join(__dirname, 'index.html'), 'utf-8') }); -result.then(html => console.log(html)); +result + .then(html => console.log(html)) + // If rendering the module factory fails, exit the process with an error code because otherwise + // the CI task will not recognize the failure and will show as "success". The error message + // will be printed automatically by the `renderModuleFactory` method. + .catch(() => process.exit(1));