import { ExceptionHandler } from 'angular2/core' ; class ArrayLogger { res = [ ] ; log ( s ) { this . res . push ( s ) ; } logError ( s ) { this . res . push ( s ) ; } logGroup ( s ) { this . res . push ( s ) ; } logGroupEnd ( ) { this . res . forEach ( error => { console . error ( error ) ; } ) ; } ; } export class CustomExceptionHandler extends ExceptionHandler { constructor ( ) { super ( new ArrayLogger ( ) , true ) ; } call ( exception , stackTrace , reason ) { if ( ~ [ 401 , 404 ] . indexOf ( exception . status ) ) { window . location . hash = '/login' ; } else { super . call ( exception , stackTrace , reason ) ; } } }