}
// 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;
// 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);
});
};
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++) {
frame.receiver = res.body[frame.receiver.ref];
}
- if (cb) cb(trace);
+ if (cb) cb(null, trace);
});
});
};
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 {