[QA] Investigate logging common JavaScript exceptions

Jon Robson jrobson at wikimedia.org
Tue Feb 24 22:14:54 UTC 2015

I agree that this probably needs something different to EL.

I wonder is if the browser tests can log any JavaScript console errors
it encounters during test runs somewhere. This would be added
protection for us to prevent errors leaking into production. I've
cc'ed QA in case they have any ideas about that.

On Tue, Feb 24, 2015 at 2:53 AM, Sam Smith <samsmith at wikimedia.org> wrote:
> Hey folks,
> The WikiGrok team committed to the "Investigate logging common JavaScript
> exceptions" spike [0] and decided that the outcome should be an email thread
> (and, presumably, a ticket after we've hashed this out).
> Here goes nothing…
>> We get various errors such as Error: Module not found: toast Error: Module
>> not found: toast
>> When these occur it would be good to somehow log this to catch dependency
>> problems.
>> In theory EventLogging should be able to handle this.
>> 1. Is this a good idea?
> Logging errors to something that isn't an error log?
> That aside, I don't think logging errors directly to EL is a good idea,
> particularly when we don't know the frequency at which they happen.
>> 2. Is it possible?
> Sure. See GlobalEventHandlers.onerror [1].
>> 3. How would we do it?
> I would advise against logging events directly. Define an API for reporting
> client-side errors that may or may not use EL as a backend, which we can
> change as requirements change without affecting clients. Flexibility it
> great, but, more importantly, we'd get control: we could throttle the number
> of errors being logged to EL if something nasty sneaks into production (or
> has already snuck in) and we could deduplicate errors if necessary.
> So: install an onerror event handler, report the error via the API, and,
> whenever possible, tell the user that something has gone wrong and that
> we've made a note of it.
> –Sam
> [0]
> https://trello.com/c/wuMIhyyc/6-spike-investigate-logging-common-javascript-exceptions-2-hours
> [1]
> https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onerror

More information about the QA mailing list