ErrorHandler

Stable Class

Class Overview

class ErrorHandler {
  constructor(rethrowError?: boolean)
  
  
  handleError(error: any) : void
}

Class 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.

Example

class MyErrorHandler implements ErrorHandler {
  call(error, stackTrace = null, reason = null) {
    // do something with the exception
  }
}

@NgModule({
  providers: [{provide: ErrorHandler, useClass: MyErrorHandler}]
})
class MyModule {}

Constructor

constructor(rethrowError?: boolean)

Class Details

handleError(error: any) : void

exported from @angular/core/index, defined in @angular/core/src/error_handler.ts

doc_Angular
2016-10-06 09:46:27
Comments
Leave a Comment

Please login to continue.