How can I break at unhandled exceptions in a Cordova application?


I’m having a strange issue with my ionic 2 application. I’m deploying and debugging onto a Windows 10 Mobile emulator, but I’m repeatedly having a problem where the application shuts down/crashes, and I don’t know why. I’ve tried adding in a error hook like so.

<script type="text/javascript">
        window.addEventListener("error", function (e) {

But it’s not called reliably. I’ve also tried adding in a ErrorHandler from @angular/core and it gets called…sometimes. I’m beginning to think that the error is occurring outside of my JavaScript, but I’m not sure where to begin to catch unhandled exceptions at that level. Any ideas?

Snippet of my package.json file

"dependencies": {
    "@angular/common": "2.2.1",
    "@angular/compiler": "2.2.1",
    "@angular/compiler-cli": "2.2.1",
    "@angular/core": "2.2.1",
    "@angular/forms": "2.2.1",
    "@angular/http": "2.2.1",
    "@angular/platform-browser": "2.2.1",
    "@angular/platform-browser-dynamic": "2.2.1",
    "@angular/platform-server": "2.2.1",
    "@ionic/storage": "1.1.6",
    "ionic-angular": "2.0.0-rc.3-201611211919",
    "ionic-native": "2.2.3",
    "ionicons": "3.0.0",
    "moment": "2.15.1",
    "rxjs": "5.0.0-beta.12",
    "zone.js": "0.6.26",

    "angular2-moment": "1.0.0-beta.rc.1",
    "font-awesome": "4.7.0"
  "devDependencies": {
    "@ionic/app-scripts": "0.0.44",
    "typescript": "2.0.9",
    "webpack-bundle-analyzer": "^1.5.3"