Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
debugger: breakOnException
Browse files Browse the repository at this point in the history
Do not break automatically on exception, fixes #2926
  • Loading branch information
indutny committed Mar 19, 2012
1 parent b6cb6ce commit 7418905
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions lib/_debugger.js
Expand Up @@ -678,6 +678,7 @@ var commands = [
'kill',
'list',
'scripts',
'breakOnException',
'breakpoints',
'version'
]
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 7418905

Please sign in to comment.