From 9ce08196f84b10e229e0c805bccbee09c65dd92f Mon Sep 17 00:00:00 2001 From: Stanimira Vlaeva Date: Thu, 1 Mar 2018 11:05:12 +0200 Subject: [PATCH] fix: throw if global css file is not found in webpack context (#5186) --- tns-core-modules/application/application-common.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tns-core-modules/application/application-common.ts b/tns-core-modules/application/application-common.ts index dd3a64e21..32ab9dc04 100644 --- a/tns-core-modules/application/application-common.ts +++ b/tns-core-modules/application/application-common.ts @@ -88,7 +88,12 @@ export function getCssFileName(): string { } export function loadAppCss(): void { - events.notify({ eventName: "loadAppCss", object: app, cssFile: getCssFileName() }); + try { + events.notify({ eventName: "loadAppCss", object: app, cssFile: getCssFileName() }); + } catch (e) { + throw new Error(`The file ${getCssFileName()} couldn't be loaded! ` + + `You may need to register it inside ./app/vendor.ts.`); + } } export function addCss(cssText: string): void { @@ -97,4 +102,4 @@ export function addCss(cssText: string): void { global.__onUncaughtError = function (error: NativeScriptError) { events.notify({ eventName: uncaughtErrorEvent, object: app, android: error, ios: error, error: error }); -} \ No newline at end of file +}