From 29328a332e95c7fb1276131f3eac4e59692d8c20 Mon Sep 17 00:00:00 2001 From: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com> Date: Tue, 24 Oct 2023 14:37:53 +0200 Subject: [PATCH] throw errors instead of console to stop the application --- .../src/apps/app/app.element.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/apps/app/app.element.ts b/src/Umbraco.Web.UI.Client/src/apps/app/app.element.ts index 501cad9257..f51e46a216 100644 --- a/src/Umbraco.Web.UI.Client/src/apps/app/app.element.ts +++ b/src/Umbraco.Web.UI.Client/src/apps/app/app.element.ts @@ -88,8 +88,7 @@ export class UmbAppElement extends UmbLitElement { // This way we can ensure that the document language is always loaded first and subsequently registered as the fallback language. umbLocalizationRegistry.isDefaultLoaded.subscribe((isDefaultLoaded) => { if (!this.#authContext) { - console.error('[Fatal] AuthContext requested before it was initialised'); - return; + throw new Error('[Fatal] AuthContext requested before it was initialised'); } if (!isDefaultLoaded) return; @@ -185,12 +184,11 @@ export class UmbAppElement extends UmbLitElement { } async #setAuthStatus() { - if (!this.#authContext) { - console.error('[Fatal] AuthContext requested before it was initialised'); - return; - } - if (this.bypassAuth === false) { + if (!this.#authContext) { + throw new Error('[Fatal] AuthContext requested before it was initialised'); + } + // Get service configuration from authentication server await this.#authContext.setInitialState();