/** * @license * Copyright 2025 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { ErrorHandler } from '@angular/core'; import { CrashlyticsOptions } from '../public-types'; import { FirebaseApp } from '@firebase/app'; export * from '../public-types'; /** * A custom ErrorHandler that captures uncaught errors and sends them to Firebase Crashlytics. * * This should be provided in your application's root module. * * @example * Basic usage: * ```typescript * import { ApplicationConfig, ErrorHandler } from '@angular/core'; * import { FirebaseErrorHandler } from 'firebase/crashlytics-angular'; * * export const appConfig: ApplicationConfig = { * providers: [ * { * provide: ErrorHandler, * useFactory: () => new FirebaseErrorHandler(firebaseApp) * } * ], * // ... * }; * ``` * * @example * Providing telemetry options: * ```typescript * import { ApplicationConfig, ErrorHandler } from '@angular/core'; * import { FirebaseErrorHandler } from 'firebase/crashlytics-angular'; * * export const appConfig: ApplicationConfig = { * providers: [ * { * provide: ErrorHandler, * useFactory: () => new FirebaseErrorHandler(firebaseApp, { appVersion: '1.2.3' }) * } * ], * // ... * }; * ``` * * @param firebaseApp - The {@link @firebase/app#FirebaseApp} instance to use. * @param crashlyticsOptions - Optional. {@link CrashlyticsOptions} that configure the Crashlytics instance. * To provide these options, you must use a `useFactory` provider as shown in the example above. * * @public */ export declare class FirebaseErrorHandler implements ErrorHandler { private readonly router; private readonly crashlytics; constructor(app: FirebaseApp, crashlyticsOptions?: CrashlyticsOptions); handleError(error: unknown): void; /** * Returns a record of framework-specific attributes based on the current application state to be * attached to the error log. */ private getAttributes; /** * Constructs the safe, templated route path from the router state. * Example output: '/users/:id/posts' */ private getSafeRoutePath; }