mperdeck / jsnlog.js

Tiny JavaScript logging library, simple and well documented. Lots of options to filter logging data.
js.jsnlog.com
Other
130 stars 43 forks source link

JSNLog swallows Angular 4 template errors #67

Closed txavier closed 6 years ago

txavier commented 6 years ago

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}]}

mperdeck commented 6 years ago

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

txavier commented 6 years ago

Ok, great.

On Sat, Aug 4, 2018 at 12:09 PM mperdeck notifications@github.com wrote:

Closed #67 https://github.com/mperdeck/jsnlog.js/issues/67.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mperdeck/jsnlog.js/issues/67#event-1771301910, or mute the thread https://github.com/notifications/unsubscribe-auth/AFzP0sja-pI8QfHTww-QWPjZoWpXO7muks5uNcdKgaJpZM4VbRhr .