diff --git a/src/app/app.component.ts b/src/app/app.component.ts index ceabd2f5d..25129e6c9 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -63,12 +63,17 @@ export class AppComponent implements OnDestroy, OnInit, AfterViewInit { const oldError = console.error; (() => { // tslint:disable-next-line:only-arrow-functions - console.error = function (error) { + console.error = function (error, context) { let debug = ''; let stack = ''; if (typeof error === 'string') { debug = error; + + if (error === 'ERROR' && !isNullOrUndefined(context) && context.hasOwnProperty('stack') && context.hasOwnProperty('message')) { + debug = context.message; + stack = context.stack; + } } else { if (error instanceof Error) { debug = error.message; @@ -85,7 +90,7 @@ export class AppComponent implements OnDestroy, OnInit, AfterViewInit { } if (debug !== '') { - serv.addEntry(ConsoleType.ERROR, `${debug}: ${stack}`); + serv.addEntry(ConsoleType.ERROR, `${debug}${(stack !== '') ? ' ' + stack : ''}`); } oldError.apply(console, arguments); @@ -105,6 +110,9 @@ export class AppComponent implements OnDestroy, OnInit, AfterViewInit { } ngOnInit() { + setTimeout(() => { + console.error(`test fehler`); + }, 4000); this.subscrmanager.add(this.settingsService.dbloaded.subscribe( () => { if (!isNullOrUndefined(this.appStorage.asrSelectedService) && !isNullOrUndefined(this.appStorage.asrSelectedLanguage)) {