diff --git a/npm/ng-packs/packages/theme-shared/src/lib/handlers/error.handler.ts b/npm/ng-packs/packages/theme-shared/src/lib/handlers/error.handler.ts index 1197940ca8..98f4ece491 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/handlers/error.handler.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/handlers/error.handler.ts @@ -89,11 +89,11 @@ export class ErrorHandler { protected filterRestErrors = ({ status }: HttpErrorResponse): boolean => { if (typeof status !== 'number') return false; - if(!this.httpErrorConfig.skipHandledErrorCodes){ + + if (!this.httpErrorConfig.skipHandledErrorCodes) { return true; } - return ( - this.httpErrorConfig.skipHandledErrorCodes.findIndex(code => code === status) < 0 - ); + + return this.httpErrorConfig.skipHandledErrorCodes.findIndex(code => code === status) < 0; }; } diff --git a/npm/ng-packs/packages/theme-shared/src/lib/services/router-error-handler.service.ts b/npm/ng-packs/packages/theme-shared/src/lib/services/router-error-handler.service.ts index 14a4e79266..9235204b99 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/services/router-error-handler.service.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/services/router-error-handler.service.ts @@ -20,9 +20,12 @@ export class RouterErrorHandlerService { } protected filterRouteErrors = (navigationError: NavigationError): boolean => { + if (!this.httpErrorConfig.skipHandledErrorCodes) { + return true; + } + return ( navigationError.error?.message?.indexOf('Cannot match') > -1 && - !!this.httpErrorConfig.skipHandledErrorCodes && this.httpErrorConfig.skipHandledErrorCodes.findIndex(code => code === 404) < 0 ); };