Skip to content

Commit

Permalink
Capture column numbers provided by blink/chrome
Browse files Browse the repository at this point in the history
Issue #14 (changes from raygun)
  • Loading branch information
niemyjski committed May 16, 2015
1 parent ed83e26 commit 1806c98
Showing 1 changed file with 27 additions and 20 deletions.
47 changes: 27 additions & 20 deletions tracekit.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,28 +158,35 @@ TraceKit.report = (function reportModuleWrapper() {
* @param {(number|string)} lineNo The line number at which the error
* occurred.
*/
function traceKitWindowOnError(message, url, lineNo) {
function traceKitWindowOnError(message, url, lineNo, columnNo, errorObj) {
var stack = null;

if (lastExceptionStack) {
TraceKit.computeStackTrace.augmentStackTraceWithInitialElement(lastExceptionStack, url, lineNo, message);
stack = lastExceptionStack;
lastExceptionStack = null;
lastException = null;
} else {
var location = {
'url': url,
'line': lineNo
};
location.func = TraceKit.computeStackTrace.guessFunctionName(location.url, location.line);
location.context = TraceKit.computeStackTrace.gatherContext(location.url, location.line);
stack = {
'mode': 'onerror',
'message': message,
'url': document.location.href,
'stack': [location],
'useragent': navigator.userAgent
};
if (errorObj) {
stack = TraceKit.computeStackTrace(errorObj);
}
else
{
if (lastExceptionStack) {
TraceKit.computeStackTrace.augmentStackTraceWithInitialElement(lastExceptionStack, url, lineNo, message);
stack = lastExceptionStack;
lastExceptionStack = null;
lastException = null;
} else {
var location = {
'url': url,
'line': lineNo,
'column': columnNo
};
location.func = TraceKit.computeStackTrace.guessFunctionName(location.url, location.line);
location.context = TraceKit.computeStackTrace.gatherContext(location.url, location.line);
stack = {
'mode': 'onerror',
'message': message,
'url': document.location.href,
'stack': [location],
'useragent': navigator.userAgent
};
}
}

notifyHandlers(stack, 'from window.onerror');
Expand Down

0 comments on commit 1806c98

Please sign in to comment.