Permalink
Browse files

debugger: breakOnException

Do not break automatically on exception, fixes #2926
  • Loading branch information...
1 parent 74e20d4 commit 82ba1c52387fea7bb681dc71609f2f7192dacc63 @indutny committed Mar 18, 2012
Showing with 17 additions and 6 deletions.
  1. +17 −6 lib/_debugger.js
View
@@ -678,6 +678,7 @@ var commands = [
'kill',
'list',
'scripts',
+ 'breakOnException',
'breakpoints',
'version'
]
@@ -1308,6 +1309,19 @@ Interface.prototype.watchers = function() {
}
};
+// Break on exception
+Interface.prototype.breakOnException = function breakOnException() {
+ if (!this.requireConnection()) return;
+
+ var self = this;
+
+ // Break on exceptions
+ this.pause();
+ this.client.reqSetExceptionBreak('all', function(err, res) {
+ self.resume();
+ });
+};
+
// Add breakpoint
Interface.prototype.setBreakpoint = function(script, line,
condition, silent) {
@@ -1626,19 +1640,16 @@ Interface.prototype.trySpawn = function(cb) {
self.setBreakpoint(bp.scriptId, bp.line, bp.condition, true);
});
- // Break on exceptions
- client.reqSetExceptionBreak('all', function(err, res) {
- cb && cb();
- self.resume();
- });
-
client.on('close', function() {
self.pause();
self.print('program terminated');
self.resume();
self.client = null;
self.killChild();
});
+
+ if (cb) cb();
+ self.resume();
});
client.on('unhandledResponse', function(res) {

0 comments on commit 82ba1c5

Please sign in to comment.