Daniel Patrick
Daniel Patrick

Reputation: 4340

How do I override the Angular 2 Exception Handler?

It looks like the old way of doing that was this:

bootstrap(App, [
    provide(ExceptionHandler, { useClass: CustomExceptionHander })
])

How do you do it in the app.module.ts (post rc-5)?

Upvotes: 0

Views: 104

Answers (1)

Günter Zöchbauer
Günter Zöchbauer

Reputation: 658017

update ExceptionHandler was renamed to ErrorHandler https://stackoverflow.com/a/35239028/217408

orgiginal

The syntax you use was deprecated a while ago and was removed in recent versions already.
Use object literal syntax like this instead:

@NgModule({
  providers: [{provide: ExceptionHandler, useClass: CustomExceptionHander }],
  ...
})

Upvotes: 2

Related Questions