Skip to content

Commit 1806c98

Browse files
committed
Capture column numbers provided by blink/chrome
Issue #14 (changes from raygun)
1 parent ed83e26 commit 1806c98

File tree

1 file changed

+27
-20
lines changed

1 file changed

+27
-20
lines changed

tracekit.js

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -158,28 +158,35 @@ TraceKit.report = (function reportModuleWrapper() {
158158
* @param {(number|string)} lineNo The line number at which the error
159159
* occurred.
160160
*/
161-
function traceKitWindowOnError(message, url, lineNo) {
161+
function traceKitWindowOnError(message, url, lineNo, columnNo, errorObj) {
162162
var stack = null;
163163

164-
if (lastExceptionStack) {
165-
TraceKit.computeStackTrace.augmentStackTraceWithInitialElement(lastExceptionStack, url, lineNo, message);
166-
stack = lastExceptionStack;
167-
lastExceptionStack = null;
168-
lastException = null;
169-
} else {
170-
var location = {
171-
'url': url,
172-
'line': lineNo
173-
};
174-
location.func = TraceKit.computeStackTrace.guessFunctionName(location.url, location.line);
175-
location.context = TraceKit.computeStackTrace.gatherContext(location.url, location.line);
176-
stack = {
177-
'mode': 'onerror',
178-
'message': message,
179-
'url': document.location.href,
180-
'stack': [location],
181-
'useragent': navigator.userAgent
182-
};
164+
if (errorObj) {
165+
stack = TraceKit.computeStackTrace(errorObj);
166+
}
167+
else
168+
{
169+
if (lastExceptionStack) {
170+
TraceKit.computeStackTrace.augmentStackTraceWithInitialElement(lastExceptionStack, url, lineNo, message);
171+
stack = lastExceptionStack;
172+
lastExceptionStack = null;
173+
lastException = null;
174+
} else {
175+
var location = {
176+
'url': url,
177+
'line': lineNo,
178+
'column': columnNo
179+
};
180+
location.func = TraceKit.computeStackTrace.guessFunctionName(location.url, location.line);
181+
location.context = TraceKit.computeStackTrace.gatherContext(location.url, location.line);
182+
stack = {
183+
'mode': 'onerror',
184+
'message': message,
185+
'url': document.location.href,
186+
'stack': [location],
187+
'useragent': navigator.userAgent
188+
};
189+
}
183190
}
184191

185192
notifyHandlers(stack, 'from window.onerror');

0 commit comments

Comments
 (0)