Skip to content

Instantly share code, notes, and snippets.

Created Apr 15, 2011
What would you like to do?
function customPrepareStackTrace(error, structuredStackTrace) {
return structuredStackTrace[0].getLineNumber();
function getLineNumber() {
var original = Error.prepareStackTrace;
Error.prepareStackTrace = customPrepareStackTrace;
var error = {};
Error.captureStackTrace(error, getLineNumber);
var lineNumber = error.stack;
Error.prepareStackTrace = original;
return lineNumber;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment