[SOLVED] Ionic 2 window.onerror

i am trying to catch JS errors with window.onerror but this doesnt work

import ...... window.onerror = function() { console.log('error'); return false; }; @Componet().......

What i am doing wrong?


I solved my problem, i extended ExceptionHandler class, and put this in my app.js:

ionicBootstrap(MyApp, [{ provide: ExceptionHandler, useClass: CustomExceptionHandler }] );

and this caught all exceptions.