Column is undefined in stacktrace

maayan.cohen

Posted on
Dec 26 2013

Hi,

Almost every stacktrace I get has no column defined.

Examples:

ReferenceError: Can't find variable: admwl
     at ? line 1, column undefined (undefined:1)

ReferenceError: Components is not defined
     at ? line 7, column undefined

John-Daniel Trask

Raygun

Posted on
Dec 28 2013

Hi,

Unfortunately this is caused by the browser error handling, which is not very good (although the Chromium team is working on improvements from their engine).

Raygun attaches, by default, to the window.onerror handler. This is a global error handler and allows Raygun to catch everything (simplifying here, we also look for things like jQuery's ajax error handler which would otherwise swallow errors).

One way to get the 'column' value in more browsers is to catch the exception yourself, and manually pass it to Raygun. It seems most browsers simply lose the 'column' value when it goes via the window.onerror event. You can read about how to handle errors on the GitHub page ('To submit manual errors' section):

https://github.com/MindscapeHQ/raygun4js

So if you have specific areas of your JS code that are prone to errors, try wrapping and sending them manually, that way you are more likely to get the column number.

We're also watching for when the Chrome team improve their default error handling and I personally expect the FireFox team won't be far behind. One day we can hope IE also improves their error handling.

I hope this detail helps explain what's happening with the stack traces. Some of our team are on Christmas holiday right now, so if you think something is actually broken (e.g. you still don't get column numbers when manually sending) do let us know and we can investigate further.

I hope that helps,

John-Daniel Trask
Co-founder
Mindscape


Reply