Skip to content

Commit

Permalink
dumper.js: missing entry in liveItems stops build()
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Sep 3, 2014
1 parent 1a6a756 commit 0b0a05e
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/Tracy/templates/dumper.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,15 @@
liveItems[id] = liveData[id];
}
Array.prototype.forEach.call(document.querySelectorAll('.tracy-dump[data-tracy-dump]'), function(dest) {
dest.appendChild(build(JSON.parse(dest.getAttribute('data-tracy-dump')), Tracy.hasClass(dest, 'tracy-collapsed')));
Tracy.removeClass(dest, 'tracy-collapsed');
dest.removeAttribute('data-tracy-dump');
try {
dest.appendChild(build(JSON.parse(dest.getAttribute('data-tracy-dump')), Tracy.hasClass(dest, 'tracy-collapsed')));
Tracy.removeClass(dest, 'tracy-collapsed');
dest.removeAttribute('data-tracy-dump');
} catch (e) {
if (!(e instanceof UnknownEntityException)) {
throw e;
}
}
});

if (this.inited) {
Expand Down Expand Up @@ -82,6 +88,10 @@
var id = data.object || data.resource,
object = liveItems[id];

if (!object) {
throw new UnknownEntityException;
}

return buildStruct([
createEl('span', {
'class': data.object ? 'tracy-dump-object' : 'tracy-dump-resource',
Expand Down Expand Up @@ -153,4 +163,6 @@
}
};

var UnknownEntityException = function() {};

})();

0 comments on commit 0b0a05e

Please sign in to comment.