GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Docs
  • Tutorials
  • Playground
  • Reference
  • code
  • Unhandled errors in Angular

This view

  • Original page
  • New address

GeezerVison is showing angular.dev — ErrorHandler • Angular

API

    
      class ErrorHandler {}
    
    
@paramerrorany
@returnsvoid

Callback to handle errors happening during the rendering of a component/directive view.

@paramerrorError

The error that was thrown.

@paramdetailsErrorDetails

Additional information about the error.

@returnsvoid

Description

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.

Usage Notes

Example

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 {}
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.