static-injector
Version:
Angular 依赖注入独立版本;Angular dependency injection standalone version
46 lines (45 loc) • 1.11 kB
TypeScript
/**
* @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
*/
/**
* Provides a hook for centralized exception handling.
*
* The default implementation of `ErrorHandler` prints error messages to the `console`. To
* intercept error handling, write a custom exception handler that replaces this default as
* appropriate for your app.
*
* @usageNotes
* ### Example
*
* ```ts
* class MyErrorHandler implements ErrorHandler {
* handleError(error) {
* // do something with the exception
* }
* }
*
* // Provide in standalone apps
* bootstrapApplication(AppComponent, {
* providers: [{provide: ErrorHandler, useClass: MyErrorHandler}]
* })
*
* // Provide in module-based apps
* @NgModule({
* providers: [{provide: ErrorHandler, useClass: MyErrorHandler}]
* })
* class MyModule {}
* ```
*
* @publicApi
*/
export declare class ErrorHandler {
/**
* @internal
*/
_console: Console;
handleError(error: any): void;
}