/
githubmirror
/
components
Обзор
Документация
Войти
/
githubmirror
/
components
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
docs/src/app/shared/analytics/error-report-handler.ts
27 строк
803 B
Kristiyan Kostadinov
build: switch docs to service decorator
25 апр 2026, 23:10
25 апр 2026, 23:10
7ac0542
Код
Авторство
О чём код?
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {ErrorHandler, Service, inject} from '@angular/core'; import {AnalyticsService} from './analytics'; import {formatErrorForAnalytics} from './format-error'; @Service({autoProvided: false}) export class AnalyticsErrorReportHandler extends ErrorHandler { private _analytics = inject(AnalyticsService); handleError(error: any): void { super.handleError(error); // Report the error in Google Analytics. if (error instanceof Error) { this._analytics.reportError(formatErrorForAnalytics(error)); } else { this._analytics.reportError(error.toString()); } } }