@@ -137,22 +137,21 @@ TraceKit.report = (function reportModuleWrapper() {
137137 /**
138138 * Ensures all global unhandled exceptions are recorded.
139139 * Supported by Gecko and IE.
140- * @param {string } message Error message.
140+ * @param {string } msg Error message.
141141 * @param {string } url URL of script that generated the exception.
142142 * @param {(number|string) } lineNo The line number at which the error
143143 * occurred.
144144 * @param {?(number|string) } colNo The column number at which the error
145145 * occurred.
146146 * @param {?Error } ex The actual Error object.
147147 */
148- function traceKitWindowOnError ( message , url , lineNo , colNo , ex ) {
148+ function traceKitWindowOnError ( msg , url , lineNo , colNo , ex ) {
149149 var stack = null ;
150-
151150 // 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+
156155 if ( lastExceptionStack ) {
157156 TraceKit . computeStackTrace . augmentStackTraceWithInitialElement (
158157 lastExceptionStack ,
@@ -161,13 +160,13 @@ TraceKit.report = (function reportModuleWrapper() {
161160 message
162161 ) ;
163162 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
166165
167166 // New chrome and blink send along a real error object
168167 // Let's just report that like a normal error.
169168 // See: https://mikewest.org/2013/08/debugging-runtime-errors-with-window-onerror
170- stack = TraceKit . computeStackTrace ( ex ) ;
169+ stack = TraceKit . computeStackTrace ( exception ) ;
171170 notifyHandlers ( stack , true ) ;
172171 } else {
173172 var location = {
@@ -177,22 +176,21 @@ TraceKit.report = (function reportModuleWrapper() {
177176 } ;
178177
179178 var name = undefined ;
180- var msg = message ; // must be new var or will modify original `arguments`
181179 var groups ;
182180
183181 if ( { } . toString . call ( message ) === '[object String]' ) {
184182 var groups = message . match ( ERROR_TYPES_RE ) ;
185183 if ( groups ) {
186184 name = groups [ 1 ] ;
187- msg = groups [ 2 ] ;
185+ message = groups [ 2 ] ;
188186 }
189187 }
190188
191189 location . func = UNKNOWN_FUNCTION ;
192190
193191 stack = {
194192 name : name ,
195- message : msg ,
193+ message : message ,
196194 url : getLocationHref ( ) ,
197195 stack : [ location ]
198196 } ;
0 commit comments