fix error handler
This commit is contained in:
parent
e16c4d54ff
commit
9382ac0063
@ -28,7 +28,7 @@ import { UserProfileScreenComponent } from '@components/user-profile/user-profil
|
||||
import { PlatformLocation } from '@angular/common';
|
||||
import { BASE_HREF } from './tokens';
|
||||
import { MONACO_PATH, MonacoEditorModule } from '@materia-ui/ngx-monaco-editor';
|
||||
import { ChunkLoaderErrorHandler } from '@utils/chunk-loader-error-handler';
|
||||
import { GlobalErrorHandler } from '@utils/global-error-handler.service';
|
||||
import { REDMissingTranslationHandler } from '@utils/missing-translations-handler';
|
||||
|
||||
export function httpLoaderFactory(httpClient: HttpClient) {
|
||||
@ -85,7 +85,7 @@ const components = [
|
||||
providers: [
|
||||
{
|
||||
provide: ErrorHandler,
|
||||
useClass: ChunkLoaderErrorHandler
|
||||
useClass: GlobalErrorHandler
|
||||
},
|
||||
{
|
||||
provide: BASE_HREF,
|
||||
|
||||
@ -1,12 +1,14 @@
|
||||
import { ErrorHandler, Injectable } from '@angular/core';
|
||||
|
||||
@Injectable()
|
||||
export class ChunkLoaderErrorHandler implements ErrorHandler {
|
||||
handleError(error: any): void {
|
||||
export class GlobalErrorHandler extends ErrorHandler {
|
||||
handleError(error: Error): void {
|
||||
const chunkFailedMessage = /Loading chunk [\d]+ failed/;
|
||||
|
||||
if (chunkFailedMessage.test(error.message)) {
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
return super.handleError(error);
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user