<div dir="ltr">I remember doing this for a client while I was a freelancer, but I do not remember the details. As far as I remember, it was not elegant, but doable. I think this would be a great topic for a hackathon. ;)<div><br></div><div>Feel free to add me to cc if somebody creates a phab ticket.</div><div><br></div><div>Željko</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Feb 24, 2015 at 11:14 PM, Jon Robson <span dir="ltr"><<a href="mailto:jrobson@wikimedia.org" target="_blank">jrobson@wikimedia.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">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">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>
_______________________________________________<br>
QA mailing list<br>
<a href="mailto:QA@lists.wikimedia.org">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>