mperdeck/jsnlog.js

JSNLog swallows Angular 4 template errors

txavier opened this issue · 2 comments

To reporoduce create an Angular 4+ project and install JSNLog. Create a template error by adding a line like {{heyya[]}} to the app.component.html file.

When a template error occurs in Angular 4 the POST from JSNLog is:

{"r":"","lg":[{"l":6000,"m":"{\"msg\":\"Uncaught Exception\",\"errorMsg\":{\"isTrusted\":true}}","n":"onerrorLogger","t":1532361868397,"u":2}]}

With a simple change to include the errorMsg.message in the JSNLog window.onerror handler the output is much more verbose:

{"r":"","lg":[{"l":6000,"m":"{\"msg\":\"Uncaught Exception\",\"errorMsg\":\"Uncaught Error: Template parse errors:\\nParser Error: Unexpected token ] at column 7 in [ {{heyya[]}} ] in ng:///AppModule/AppComponent.html@4:10 (\\\"ss=\\\"sidebar-background\\\" style=\\\"background-image: url(../assets/img/sidebar-4.jpg)\\\"></div>\\n </div>[ERROR ->]\\n {{heyya[]}}\\n <div class=\\\"main-panel\\\">\\n <app-navbar></app-navbar>\\n\\\"): ng:///AppModule/AppComponent.html@4:10\\nParser Error: Unexpected token ] at column 7 in [ {{heyya[]}} ] in ng:///AppModule/AppComponent.html@4:10 (\\\"\\n <app-navbar></app-navbar>\\n <router-outlet></router-outlet>\\n <div [ERROR ->]*ngIf=\\\"isMaps('maps')\\\">\\n <app-footer></app-footer>\\n </div>\\n\\\"): ng:///AppModule/AppComponent.html@9:13\"}","n":"onerrorLogger","t":1532361488313,"u":2}]}

Thanks. I've merged your pull request. It will go out with the next release.