Skip to content

Instantly share code, notes, and snippets.

@rudiedirkx
Created March 7, 2015 20:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rudiedirkx/eccc2d8d4b25d24aed26 to your computer and use it in GitHub Desktop.
Save rudiedirkx/eccc2d8d4b25d24aed26 to your computer and use it in GitHub Desktop.
function getTrace() {
try {
throw new Error;
}
catch (ex) {
var matches = [];
ex.stack.replace(/([^\s]+):(\d+):(\d+)/g, function(all, file, line, column) {
file = file.replace(/^[\s\(]/g, '');
matches.push({"file": file, "line": line, "column": column});
});
matches.shift(); // Remove this function
return matches;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment