@@ -137,22 +137,21 @@ TraceKit.report = (function reportModuleWrapper() {
137
137
/**
138
138
* Ensures all global unhandled exceptions are recorded.
139
139
* Supported by Gecko and IE.
140
- * @param {string } message Error message.
140
+ * @param {string } msg Error message.
141
141
* @param {string } url URL of script that generated the exception.
142
142
* @param {(number|string) } lineNo The line number at which the error
143
143
* occurred.
144
144
* @param {?(number|string) } colNo The column number at which the error
145
145
* occurred.
146
146
* @param {?Error } ex The actual Error object.
147
147
*/
148
- function traceKitWindowOnError ( message , url , lineNo , colNo , ex ) {
148
+ function traceKitWindowOnError ( msg , url , lineNo , colNo , ex ) {
149
149
var stack = null ;
150
-
151
150
// If 'ex' is ErrorEvent, get real Error from inside
152
- if ( utils . isErrorEvent ( ex ) ) ex = ex . error ;
153
- // If 'message ' is ErrorEvent, get real message from inside
154
- if ( utils . isErrorEvent ( message ) ) message = message . message ;
155
-
151
+ var exception = utils . isErrorEvent ( ex ) ? ex . error : ex ;
152
+ // If 'msg ' is ErrorEvent, get real message from inside
153
+ var message = utils . isErrorEvent ( msg ) ? msg . message : msg ;
154
+
156
155
if ( lastExceptionStack ) {
157
156
TraceKit . computeStackTrace . augmentStackTraceWithInitialElement (
158
157
lastExceptionStack ,
@@ -161,13 +160,13 @@ TraceKit.report = (function reportModuleWrapper() {
161
160
message
162
161
) ;
163
162
processLastException ( ) ;
164
- } else if ( ex && utils . isError ( ex ) ) {
165
- // non-string `ex ` arg; attempt to extract stack trace
163
+ } else if ( exception && utils . isError ( exception ) ) {
164
+ // non-string `exception ` arg; attempt to extract stack trace
166
165
167
166
// New chrome and blink send along a real error object
168
167
// Let's just report that like a normal error.
169
168
// See: https://mikewest.org/2013/08/debugging-runtime-errors-with-window-onerror
170
- stack = TraceKit . computeStackTrace ( ex ) ;
169
+ stack = TraceKit . computeStackTrace ( exception ) ;
171
170
notifyHandlers ( stack , true ) ;
172
171
} else {
173
172
var location = {
@@ -177,22 +176,21 @@ TraceKit.report = (function reportModuleWrapper() {
177
176
} ;
178
177
179
178
var name = undefined ;
180
- var msg = message ; // must be new var or will modify original `arguments`
181
179
var groups ;
182
180
183
181
if ( { } . toString . call ( message ) === '[object String]' ) {
184
182
var groups = message . match ( ERROR_TYPES_RE ) ;
185
183
if ( groups ) {
186
184
name = groups [ 1 ] ;
187
- msg = groups [ 2 ] ;
185
+ message = groups [ 2 ] ;
188
186
}
189
187
}
190
188
191
189
location . func = UNKNOWN_FUNCTION ;
192
190
193
191
stack = {
194
192
name : name ,
195
- message : msg ,
193
+ message : message ,
196
194
url : getLocationHref ( ) ,
197
195
stack : [ location ]
198
196
} ;
0 commit comments