|
46 | 46 | return { |
47 | 47 | /** |
48 | 48 | * Given an Error object, extract the most information from it. |
49 | | - * @param error {Error} |
50 | | - * @return Array[StackFrame] |
| 49 | + * |
| 50 | + * @param {Error} error object |
| 51 | + * @return {Array} of StackFrames |
51 | 52 | */ |
52 | 53 | parse: function ErrorStackParser$$parse(error) { |
53 | 54 | if (typeof error.stacktrace !== 'undefined' || typeof error['opera#sourceloc'] !== 'undefined') { |
|
63 | 64 |
|
64 | 65 | /** |
65 | 66 | * Separate line and column numbers from a URL-like string. |
66 | | - * @param urlLike String |
67 | | - * @return Array[String] |
| 67 | + * |
| 68 | + * @param {String} urlLike |
| 69 | + * @return {Array} 3-tuple of URL, Line Number, and Column Number |
68 | 70 | */ |
69 | 71 | extractLocation: function ErrorStackParser$$extractLocation(urlLike) { |
70 | 72 | // Fail-fast but return locations like "(native)" |
|
120 | 122 | var tokens = line.split('@'); |
121 | 123 | var locationParts = this.extractLocation(tokens.pop()); |
122 | 124 | var functionName = tokens.join('@') || undefined; |
123 | | - return new StackFrame(functionName, undefined, locationParts[0], locationParts[1], locationParts[2], line); |
| 125 | + return new StackFrame(functionName, |
| 126 | + undefined, |
| 127 | + locationParts[0], |
| 128 | + locationParts[1], |
| 129 | + locationParts[2], |
| 130 | + line); |
124 | 131 | } |
125 | 132 | }, this); |
126 | 133 | }, |
|
159 | 166 | for (var i = 0, len = lines.length; i < len; i += 2) { |
160 | 167 | var match = lineRE.exec(lines[i]); |
161 | 168 | if (match) { |
162 | | - result.push(new StackFrame(match[3] || undefined, undefined, match[2], match[1], undefined, lines[i])); |
| 169 | + result.push( |
| 170 | + new StackFrame( |
| 171 | + match[3] || undefined, |
| 172 | + undefined, |
| 173 | + match[2], |
| 174 | + match[1], |
| 175 | + undefined, |
| 176 | + lines[i] |
| 177 | + ) |
| 178 | + ); |
163 | 179 | } |
164 | 180 | } |
165 | 181 |
|
|
183 | 199 | if (functionCall.match(/\(([^\)]*)\)/)) { |
184 | 200 | argsRaw = functionCall.replace(/^[^\(]+\(([^\)]*)\)$/, '$1'); |
185 | 201 | } |
186 | | - var args = (argsRaw === undefined || argsRaw === '[arguments not available]') ? undefined : argsRaw.split(','); |
187 | | - return new StackFrame(functionName, args, locationParts[0], locationParts[1], locationParts[2], line); |
| 202 | + var args = (argsRaw === undefined || argsRaw === '[arguments not available]') ? |
| 203 | + undefined : argsRaw.split(','); |
| 204 | + return new StackFrame( |
| 205 | + functionName, |
| 206 | + args, |
| 207 | + locationParts[0], |
| 208 | + locationParts[1], |
| 209 | + locationParts[2], |
| 210 | + line); |
188 | 211 | }, this); |
189 | 212 | } |
190 | 213 | }; |
|
0 commit comments