<div dir="ltr"><div>onerror and its behavior is brittle and crappy and practically useless with minified code. Something to read <a href="https://danlimerick.wordpress.com/2014/01/18/how-to-catch-javascript-errors-with-window-onerror-even-on-chrome-and-firefox/">https://danlimerick.wordpress.com/2014/01/18/how-to-catch-javascript-errors-with-window-onerror-even-on-chrome-and-firefox/</a><br><br></div>It may be better than nothing, but probably useless or confusing most of the time.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 25, 2015 at 12:28 AM, Chris McMahon <span dir="ltr"><<a href="mailto:cmcmahon@wikimedia.org" target="_blank">cmcmahon@wikimedia.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><br></div>By design, Selenium knows nothing about javascript errors. We don't really have any tools to hand to do this sort of thing, the approach that Sam talks about makes more sense.<div>-Chris <br><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Tue, Feb 24, 2015 at 3:14 PM, Jon Robson <span dir="ltr"><<a href="mailto:jrobson@wikimedia.org" target="_blank">jrobson@wikimedia.org</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">I agree that this probably needs something different to EL.<br>
<br>
I wonder is if the browser tests can log any JavaScript console errors<br>
it encounters during test runs somewhere. This would be added<br>
protection for us to prevent errors leaking into production. I've<br>
cc'ed QA in case they have any ideas about that.<br>
<br>
<br>
On Tue, Feb 24, 2015 at 2:53 AM, Sam Smith <<a href="mailto:samsmith@wikimedia.org" target="_blank">samsmith@wikimedia.org</a>> wrote:<br>
> Hey folks,<br>
><br>
> The WikiGrok team committed to the "Investigate logging common JavaScript<br>
> exceptions" spike [0] and decided that the outcome should be an email thread<br>
> (and, presumably, a ticket after we've hashed this out).<br>
><br>
> Here goes nothing…<br>
><br>
>> We get various errors such as Error: Module not found: toast Error: Module<br>
>> not found: toast<br>
>> When these occur it would be good to somehow log this to catch dependency<br>
>> problems.<br>
>> In theory EventLogging should be able to handle this.<br>
><br>
><br>
>> 1. Is this a good idea?<br>
><br>
><br>
> Logging errors to something that isn't an error log?<br>
><br>
> That aside, I don't think logging errors directly to EL is a good idea,<br>
> particularly when we don't know the frequency at which they happen.<br>
><br>
>> 2. Is it possible?<br>
><br>
><br>
> Sure. See GlobalEventHandlers.onerror [1].<br>
><br>
>> 3. How would we do it?<br>
><br>
><br>
> I would advise against logging events directly. Define an API for reporting<br>
> client-side errors that may or may not use EL as a backend, which we can<br>
> change as requirements change without affecting clients. Flexibility it<br>
> great, but, more importantly, we'd get control: we could throttle the number<br>
> of errors being logged to EL if something nasty sneaks into production (or<br>
> has already snuck in) and we could deduplicate errors if necessary.<br>
><br>
> So: install an onerror event handler, report the error via the API, and,<br>
> whenever possible, tell the user that something has gone wrong and that<br>
> we've made a note of it.<br>
><br>
> –Sam<br>
><br>
> [0]<br>
> <a href="https://trello.com/c/wuMIhyyc/6-spike-investigate-logging-common-javascript-exceptions-2-hours" target="_blank">https://trello.com/c/wuMIhyyc/6-spike-investigate-logging-common-javascript-exceptions-2-hours</a><br>
> [1]<br>
> <a href="https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onerror" target="_blank">https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onerror</a><br>
<br></div></div>
_______________________________________________<br>
QA mailing list<br>
<a href="mailto:QA@lists.wikimedia.org" target="_blank">QA@lists.wikimedia.org</a><br>
<a href="https://lists.wikimedia.org/mailman/listinfo/qa" target="_blank">https://lists.wikimedia.org/mailman/listinfo/qa</a><br>
</blockquote></div><br></div></div></div>
</blockquote></div><br></div>