From ca3778f9fd13fe6a968b1f21802c42f7ff5d2eb5 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Tue, 17 Jan 2012 15:35:13 +0000 Subject: [PATCH] Better error messages for eval'd code --- js/WikiStore.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/js/WikiStore.js b/js/WikiStore.js index 4beb3b2c2..349986071 100755 --- a/js/WikiStore.js +++ b/js/WikiStore.js @@ -320,8 +320,11 @@ WikiStore.prototype.compileTiddler = function(title,type) { }); if(tiddler) { if(!renderers[type]) { - var tree = this.parseTiddler(title); - renderers[type] = eval(tree.compile(type)); + var tree = this.parseTiddler(title), + text = tree.compile(type); + // Add a source URL to help debugging (see http://blog.getfirebug.com/2009/08/11/give-your-eval-a-name-with-sourceurl/) + text += "//@ sourceURL=" + encodeURIComponent(title) + "-" + type; + renderers[type] = eval(text); } return renderers[type]; } else {