diff --git a/src/app/app.component.ts b/src/app/app.component.ts index b26130032fa6620d0686dfc19c63771f8500fbe7..63bf73299ed88b27497a90bb80d1b1a9dc722b8b 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -65,10 +65,6 @@ export class AppComponent implements OnInit, OnDestroy { this.setupFocusListeners(); this.bs.getSysConfig().subscribe(sysConfig => { - this.mds.appConfig = new AppConfig(sysConfig, this.cts, this.mds.expectedApiVersion, this.sanitizer); - this.mds.appTitle$.next(this.mds.appConfig.appTitle); - this.mds.appConfig.applyBackgroundColors(); - this.mds.globalWarning = this.mds.appConfig.warningMessage; if (!sysConfig) { this.mds.appError$.next({ label: 'Server-Problem: Konnte Konfiguration nicht laden', @@ -77,6 +73,11 @@ export class AppComponent implements OnInit, OnDestroy { }); return; } + this.mds.appConfig = new AppConfig(sysConfig, this.cts, this.mds.expectedApiVersion, this.sanitizer); + this.mds.appTitle$.next(this.mds.appConfig.appTitle); + this.mds.appConfig.applyBackgroundColors(); + this.mds.globalWarning = this.mds.appConfig.warningMessage; + const authData = MainDataService.getAuthData(); if (authData) { this.cts.addCustomTexts(authData.customTexts); diff --git a/src/app/app.interceptor.ts b/src/app/app.interceptor.ts index d17d952298dca4332a0192e717e86dbe5c87b34e..e0848c43d86709b77d35ea7f6ffa57faab8ebcad 100644 --- a/src/app/app.interceptor.ts +++ b/src/app/app.interceptor.ts @@ -37,7 +37,7 @@ export class AuthInterceptor implements HttpInterceptor { return next.handle(requestA).pipe( catchError(error => { const apiError = new ApiError(999); - if (error instanceof HttpErrorResponse) { // TODO is the opposite case even possible? + if (error instanceof HttpErrorResponse) { const httpError = error as HttpErrorResponse; apiError.code = httpError.status; apiError.info = `${httpError.message} // ${httpError.error}`; @@ -112,6 +112,22 @@ export class AuthInterceptor implements HttpInterceptor { } } } + + } else if (error instanceof DOMException) { + apiError.info = `Fehler: ${error.name} // ${error.message}` + this.mds.appError$.next({ + label: `Fehler: ${error.name}`, + description: error.message, + category: 'PROBLEM' + }); + + } else { + apiError.info = 'Unbekannter Fehler'; + this.mds.appError$.next({ + label: 'Unbekannter Fehler', + description: '', + category: 'PROBLEM' + }); } return throwError(apiError); diff --git a/src/app/config/app.config.ts b/src/app/config/app.config.ts index 4ab3b7dccf1dca84666d66ab20f44a9d1f0c8283..08e255ab757427f47b91df4713ab677827fea611 100644 --- a/src/app/config/app.config.ts +++ b/src/app/config/app.config.ts @@ -74,8 +74,9 @@ export class AppConfig { ) { this.sanitizer = sanitizer; this.cts = cts; - this.customTexts = sysConfig.customTexts; + if (sysConfig) { + this.customTexts = sysConfig.customTexts; this.setCustomTexts(sysConfig.customTexts); this.setAppConfig(sysConfig.appConfig); this.testConfig = sysConfig.testConfig;