1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-21 11:35:34 +01:00

Add Custom ErrorHandler (#8543)

This commit is contained in:
Justin Baur 2024-04-01 14:29:04 -05:00 committed by GitHub
parent 136226b6be
commit 45f9f5695e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 1 deletions

View File

@ -0,0 +1,14 @@
import { ErrorHandler, Injectable } from "@angular/core";
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
@Injectable()
export class LoggingErrorHandler extends ErrorHandler {
constructor(private readonly logService: LogService) {
super();
}
override handleError(error: any): void {
this.logService.error(error);
}
}

View File

@ -1,4 +1,4 @@
import { LOCALE_ID, NgModule } from "@angular/core";
import { ErrorHandler, LOCALE_ID, NgModule } from "@angular/core";
import {
AuthRequestServiceAbstraction,
@ -238,6 +238,7 @@ import { UnauthGuard } from "../auth/guards/unauth.guard";
import { FormValidationErrorsService as FormValidationErrorsServiceAbstraction } from "../platform/abstractions/form-validation-errors.service";
import { BroadcasterService } from "../platform/services/broadcaster.service";
import { FormValidationErrorsService } from "../platform/services/form-validation-errors.service";
import { LoggingErrorHandler } from "../platform/services/logging-error-handler";
import { AngularThemingService } from "../platform/services/theming/angular-theming.service";
import { AbstractThemingService } from "../platform/services/theming/theming.service.abstraction";
import { safeProvider, SafeProvider } from "../platform/utils/safe-provider";
@ -1070,6 +1071,11 @@ const safeProviders: SafeProvider[] = [
useClass: DefaultOrganizationManagementPreferencesService,
deps: [StateProvider],
}),
safeProvider({
provide: ErrorHandler,
useClass: LoggingErrorHandler,
deps: [LogService],
}),
];
function encryptServiceFactory(