mirror of
https://github.com/bitwarden/browser
synced 2025-12-13 14:53:33 +00:00
Add Custom ErrorHandler (#8543)
This commit is contained in:
14
libs/angular/src/platform/services/logging-error-handler.ts
Normal file
14
libs/angular/src/platform/services/logging-error-handler.ts
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { LOCALE_ID, NgModule } from "@angular/core";
|
import { ErrorHandler, LOCALE_ID, NgModule } from "@angular/core";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
AuthRequestServiceAbstraction,
|
AuthRequestServiceAbstraction,
|
||||||
@@ -238,6 +238,7 @@ import { UnauthGuard } from "../auth/guards/unauth.guard";
|
|||||||
import { FormValidationErrorsService as FormValidationErrorsServiceAbstraction } from "../platform/abstractions/form-validation-errors.service";
|
import { FormValidationErrorsService as FormValidationErrorsServiceAbstraction } from "../platform/abstractions/form-validation-errors.service";
|
||||||
import { BroadcasterService } from "../platform/services/broadcaster.service";
|
import { BroadcasterService } from "../platform/services/broadcaster.service";
|
||||||
import { FormValidationErrorsService } from "../platform/services/form-validation-errors.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 { AngularThemingService } from "../platform/services/theming/angular-theming.service";
|
||||||
import { AbstractThemingService } from "../platform/services/theming/theming.service.abstraction";
|
import { AbstractThemingService } from "../platform/services/theming/theming.service.abstraction";
|
||||||
import { safeProvider, SafeProvider } from "../platform/utils/safe-provider";
|
import { safeProvider, SafeProvider } from "../platform/utils/safe-provider";
|
||||||
@@ -1070,6 +1071,11 @@ const safeProviders: SafeProvider[] = [
|
|||||||
useClass: DefaultOrganizationManagementPreferencesService,
|
useClass: DefaultOrganizationManagementPreferencesService,
|
||||||
deps: [StateProvider],
|
deps: [StateProvider],
|
||||||
}),
|
}),
|
||||||
|
safeProvider({
|
||||||
|
provide: ErrorHandler,
|
||||||
|
useClass: LoggingErrorHandler,
|
||||||
|
deps: [LogService],
|
||||||
|
}),
|
||||||
];
|
];
|
||||||
|
|
||||||
function encryptServiceFactory(
|
function encryptServiceFactory(
|
||||||
|
|||||||
Reference in New Issue
Block a user