in stackdriver-errors.js [144:169]
function resolveError(err, firstFrameIndex) {
// This will use sourcemaps and normalize the stack frames
return StackTrace.fromError(err).then(function(stack) {
var lines = [err.toString()];
// Reconstruct to a JS stackframe as expected by Error Reporting parsers.
for (var s = firstFrameIndex; s < stack.length; s++) {
// Cannot use stack[s].source as it is not populated from source maps.
lines.push([
' at ',
// If a function name is not available '<anonymous>' will be used.
stack[s].getFunctionName() || '<anonymous>', ' (',
stack[s].getFileName(), ':',
stack[s].getLineNumber(), ':',
stack[s].getColumnNumber(), ')',
].join(''));
}
return lines.join('\n');
}, function(reason) {
// Failure to extract stacktrace
return [
'Error extracting stack trace: ', reason, '\n',
err.toString(), '\n',
' (', err.file, ':', err.line, ':', err.column, ')',
].join('');
});
}