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

Commit

Permalink
handle backtrace errors
Browse files Browse the repository at this point in the history
  • Loading branch information
indutny authored and ry committed Sep 25, 2011
1 parent 2c9bcb2 commit 9b6acc2
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions lib/_debugger.js
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
});
};

Expand Down Expand Up @@ -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++) {
Expand Down Expand Up @@ -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);
});
});
};
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 9b6acc2

Please sign in to comment.