From 2626346ffce46fefee599dbf50037c06cde93c0a Mon Sep 17 00:00:00 2001 From: Tom Lieber Date: Sat, 2 Aug 2014 15:46:25 -0700 Subject: [PATCH] show uncaught exception count in epoch bar Count the number of entries in an exceptions log query, instead of the exception hit count. adobe-research/theseus#46 --- src/AgentHandle.js | 16 +++++++++++++--- src/EpochPanel.js | 6 ++---- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/AgentHandle.js b/src/AgentHandle.js index bf3f5e3..07f2f53 100644 --- a/src/AgentHandle.js +++ b/src/AgentHandle.js @@ -178,9 +178,19 @@ define(function (require, exports, module) { }); var ExceptionsAggregateHandle = makeAggregateHandleConstructor({ - _open: function () { return this._agent.trackExceptions() }, - _free: function () { this._agent.untrackExceptions(this._rawHandle) }, - _refresh: function () { return this._agent.exceptionDelta(this._rawHandle) }, + _open: function () { + var d = new $.Deferred; + this._agent.trackLogs({ ids: [], exceptions: true }, function (handle) { + if (handle === undefined) { + d.reject(); + } else { + d.resolve(handle); + } + }.bind(this)); + return d.promise(); + }, + _free: function () { /* XXX TODO */ }, + _refresh: function () { return this._agent.logCount(this._rawHandle) }, }); var ConsoleLogsAggregateHandle = makeAggregateHandleConstructor({ diff --git a/src/EpochPanel.js b/src/EpochPanel.js index 29fd5f7..bae835e 100644 --- a/src/EpochPanel.js +++ b/src/EpochPanel.js @@ -78,9 +78,7 @@ define(function (require, exports, module) { if (!(agent.id in exceptionCountByAgent)) { exceptionCountByAgent[agent.id] = 0; } - for (var nodeId in hits) { - exceptionCountByAgent[agent.id] += hits[nodeId]; - } + exceptionCountByAgent[agent.id] = hits; combineExceptions(); updateExceptionDisplay(); @@ -234,7 +232,7 @@ define(function (require, exports, module) { exceptionHandle = AgentHandle.trackExceptions(100); $(exceptionHandle).on("data", function (ev, data) { - exceptionsReceived(data.agent, data.data.counts); + exceptionsReceived(data.agent, data.data); }); $(exceptionHandle).on("agentDisconnected", function (ev, agent) { agentLeft(agent);