Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

handle backtrace errors

  • Loading branch information...
indutny authored and ry committed Sep 24, 2011
1 parent 2c9bcb2 commit 9b6acc27aad706505dff937e3b2ae6f8185b0995
Showing with 9 additions and 6 deletions.
  1. +9 −6 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 {

0 comments on commit 9b6acc2

Please sign in to comment.
You can’t perform that action at this time.