A
A
Anton Korzunov2011-05-13 08:11:37
JavaScript
Anton Korzunov, 2011-05-13 08:11:37

Javascript: Tracing errors on clients

Preamble:

To fix an error on the client, it is enough to redefine window.onerror where all js errors that would have previously floated to the top or passed unnoticed will fall down.
For example, js file loading errors, including the commonplace 404

So, we take a project that is guaranteed to work in all browsers, it has been tested many times and not by one tester.
We expose the specified handler, by hook or by crook we try to get information from the incoming error, after which we send it to the server.
About two years ago, in order not to teach testers the basics of debugging, I launched something similar on gdeetotdom.ru, the results were quite original - there were a lot of errors, mostly errors were when loading (more precisely, not loading) scripts - for example, it turns out that many people are blocked by google.com and vk, which is understandable in principle.
Sometimes the truth in the log appeared not identifiable errors, from any browser. Script error and nothing else.
According to my data, about 10% of clients failed. And somewhere 50% of them fell off completely.

Well, not so long ago I launched a similar system on another project.
The results this time are worse - the same 10% of clients, only for me it means 2k errors per hour, and the errors have become of a different kind - mostly syntactic.
Unclosed brackets, unknown functions (including those from unloaded scripts, but there are no messages about their unloading)

But what annoys me is that no matter how much I try to find a bad place on the page indicated in the log under the specified browser, it doesn’t work.
Everything there is clean (and packed)

. And finally, the question is - maybe someone knows the secrets and techniques for catching bugs that seem to exist, but you yourself and a dozen testers have never seen them.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
akzhan, 2011-05-13
@akzhan

I would like to note that onerror is not supported by all browsers.
By the way, a useful plugin on the topic: github.com/Undev/js_exceptions

K
Konstantin Kitmanov, 2011-05-13
@k12th

Do you send the user agent to the server along with the errors? Who are these 10%?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question