Skip to content

Commit

Permalink
fix: throw if global css file is not found in webpack context (#5186)
Browse files Browse the repository at this point in the history
  • Loading branch information
sis0k0 committed Mar 1, 2018
1 parent 2704915 commit 9ce0819
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tns-core-modules/application/application-common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,12 @@ export function getCssFileName(): string {
}

export function loadAppCss(): void {
events.notify(<LoadAppCSSEventData>{ eventName: "loadAppCss", object: app, cssFile: getCssFileName() });
try {
events.notify(<LoadAppCSSEventData>{ 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 {
Expand All @@ -97,4 +102,4 @@ export function addCss(cssText: string): void {

global.__onUncaughtError = function (error: NativeScriptError) {
events.notify(<UnhandledErrorEventData>{ eventName: uncaughtErrorEvent, object: app, android: error, ios: error, error: error });
}
}

0 comments on commit 9ce0819

Please sign in to comment.