Skip to content

Commit 8aa90b8

Browse files
mikelambertsteren
authored andcommitted
Handle failures to process stacktraces. (#17)
This can manifest as "Unhandled promise rejection" or "Cannot parse given Error object" messages in the browser, that occur *while* trying to run the stackdriver-errors-js code...though you'd never know it unless you were also running another javascript-error-reporting system (like I was) These breaking exceptions can happen with stacktraces like "Access Denied", which stacktrace.js fails on: stacktracejs/stacktrace.js#170
1 parent 5a260d0 commit 8aa90b8

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

stackdriver-errors.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,14 @@
113113
payload.message += [' at ', stack[s].getFunctionName(), ' (', stack[s].getFileName(), ':', stack[s].getLineNumber() ,':', stack[s].getColumnNumber() , ')'].join('');
114114
}
115115
that.sendErrorPayload(payload, callback);
116+
}, function(reason) {
117+
// Failure to extract stacktrace
118+
payload.message = [
119+
'Error extracting stack trace: ', reason, '\n',
120+
err.toString(), '\n',
121+
' (', err.file, ':', err.line, ':', err.column, ')',
122+
].join('');
123+
that.sendErrorPayload(payload, callback);
116124
});
117125
};
118126

0 commit comments

Comments
 (0)