From 0b0a05ea0941f237d4b3468681545bf5592da46d Mon Sep 17 00:00:00 2001 From: David Grudl Date: Tue, 2 Sep 2014 22:17:56 +0200 Subject: [PATCH] dumper.js: missing entry in liveItems stops build() --- src/Tracy/templates/dumper.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/Tracy/templates/dumper.js b/src/Tracy/templates/dumper.js index a531fc10d..98824f5b0 100644 --- a/src/Tracy/templates/dumper.js +++ b/src/Tracy/templates/dumper.js @@ -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) { @@ -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', @@ -153,4 +163,6 @@ } }; + var UnknownEntityException = function() {}; + })();