global error handling in order to reload page on chunk failed

This commit is contained in:
Matt Hill
2021-10-11 21:46:25 -06:00
committed by Aiden McClelland
parent 9d14d47cfd
commit db39e4432a
2 changed files with 16 additions and 1 deletions

View File

@@ -0,0 +1,13 @@
import { ErrorHandler, Injectable } from '@angular/core'
@Injectable()
export class GlobalErrorHandler implements ErrorHandler {
handleError (error: any): void {
const chunkFailedMessage = /Loading chunk [\d]+ failed/
if (chunkFailedMessage.test(error.message)) {
window.location.reload()
}
}
}