1

I want to customize the default exception handler behavior and to do that I want to override the ExceptionHandler class, but I get the next error when I use the next code

Error:

  Module '"angular2/angular2"' has no exported member 'ExceptionHandler'. 

Code:

    import {ExceptionHandler} from 'angular2/angular2';

Is this the correct aproach ? From where or what I have to import ?

AT82
  • 71,416
  • 24
  • 140
  • 167
Gustavo
  • 13
  • 4
  • Possible duplicate of [Custom Exception Handler in Angular2](http://stackoverflow.com/questions/32488245/custom-exception-handler-in-angular2) – DerekMT12 Oct 13 '16 at 12:44

2 Answers2

4

I think it's bug. ExceptionHandler must be exported here, but it's not.

For now for experimenting you can import ExceptionHandler like:

import { ExceptionHandler } from 'angular2/src/core/facade/exceptions';

Check out this plunker

alexpods
  • 47,475
  • 10
  • 100
  • 94
  • In angular2@2.0.0-beta.0 I'm using... import { ExceptionHandler } from 'angular2/src/facade/exceptions'; – inki Dec 24 '15 at 08:50
0

Here's a new plunker (modified @alexpods version) that works in beta 11. http://plnkr.co/edit/7VEjaohuse2sLneuCIVC?p=preview

Basic differences:

  • use of provide instead of bind
  • other System JS paths for import
staeke
  • 311
  • 2
  • 6