Created
February 24, 2014 04:03
-
-
Save sidorares/9181766 to your computer and use it in GitHub Desktop.
examle: capture all scopes on exception
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function bbb(x) { | |
var cc = x + 1; | |
var dd = cc + 2; | |
debugger; | |
return dd; | |
} | |
setInterval(function() { | |
var aa = 123; | |
//debugger; | |
try { | |
bbb(345); | |
//throw new Error('aaaa'); | |
} catch(e) { | |
console.log(e); | |
} | |
console.log('here'); | |
}, 1000); | |
var d = global.v8debug.Debug; | |
d.setBreakOnException(); | |
d.setListener(function(e,exec_state, event_data, data) { | |
var scopes = []; | |
for (var i=0; i < exec_state.frame(0).scopeCount(); ++i) | |
scopes.push(exec_state.frame(0).scope(i).details_.details_[1])); | |
console.log(scopes); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Noting the original tweet said to start node as: