summaryrefslogtreecommitdiff
path: root/lib/_debugger.js
diff options
context:
space:
mode:
authorFedor Indutny <fedor.indutny@gmail.com>2011-09-24 13:17:39 +0700
committerRyan Dahl <ry@tinyclouds.org>2011-09-25 11:58:22 -0700
commit9b6acc27aad706505dff937e3b2ae6f8185b0995 (patch)
tree8eae923db21e93be9d2d75f6680b55c5c81599ac /lib/_debugger.js
parent2c9bcb28be213b01c559d200f144ef283a706281 (diff)
downloadnode-new-9b6acc27aad706505dff937e3b2ae6f8185b0995.tar.gz
handle backtrace errors
Diffstat (limited to 'lib/_debugger.js')
-rw-r--r--lib/_debugger.js15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/_debugger.js b/lib/_debugger.js
index 4e3c9b2b39..a0e2cf8e7c 100644
--- a/lib/_debugger.js
+++ b/lib/_debugger.js
@@ -321,8 +321,8 @@ Client.prototype.reqEval = function(expression, cb) {
}
// Otherwise we need to get the current frame to see which scopes it has.
- this.reqBacktrace(function(bt) {
- if (!bt.frames) {
+ this.reqBacktrace(function(err, bt) {
+ if (err || !bt.frames) {
// ??
cb({});
return;
@@ -389,7 +389,7 @@ Client.prototype.reqFrameEval = function(expression, frame, cb) {
// TODO: from, to, bottom
Client.prototype.reqBacktrace = function(cb) {
this.req({ command: 'backtrace' } , function(res) {
- if (cb) cb(res.body);
+ if (cb) cb(!res.success && (res.message || true), res.body);
});
};
@@ -585,7 +585,9 @@ Client.prototype.mirrorObject = function(handle, depth, cb) {
Client.prototype.fullTrace = function(cb) {
var self = this;
- this.reqBacktrace(function(trace) {
+ this.reqBacktrace(function(err, trace) {
+ if (err) return cb(err);
+
var refs = [];
for (var i = 0; i < trace.frames.length; i++) {
@@ -620,7 +622,7 @@ Client.prototype.fullTrace = function(cb) {
frame.receiver = res.body[frame.receiver.ref];
}
- if (cb) cb(trace);
+ if (cb) cb(null, trace);
});
});
};
@@ -1101,7 +1103,8 @@ Interface.prototype.backtrace = function() {
client = this.client;
self.pause();
- client.fullTrace(function(bt) {
+ client.fullTrace(function(err, bt) {
+ if (err) return self.error(err);
if (bt.totalFrames == 0) {
self.print('(empty stack)');
} else {