On this page
ErrorHandler
class  final 
Provides a hook for centralized exception handling.
class ErrorHandler {
  handleError(error: any): void
}
   Description
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.
Further information is available in the Usage Notes...
Methods
| 
         
         handleError()
          | 
      |||
|---|---|---|---|
        
          | 
      
error | 
            any | 
            
Returns
void
Usage notes
Example
class MyErrorHandler implements ErrorHandler {
  handleError(error) {
    // do something with the exception
  }
}
@NgModule({
  providers: [{provide: ErrorHandler, useClass: MyErrorHandler}]
})
class MyModule {}
  © 2010–2022 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
 https://v13.angular.io/api/core/ErrorHandler