From ecfae4e9a97a0fc4bfc5726bf85682bf1f4e88d8 Mon Sep 17 00:00:00 2001 From: Remy Sharp Date: Sat, 10 Aug 2013 15:28:28 +0100 Subject: [PATCH] Slightly more error reporting info - though does not appear to fire at all in firefox... --- public/js/render/render.js | 2 +- public/js/runner/runner.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/public/js/render/render.js b/public/js/render/render.js index aa143cd3..192e4126 100644 --- a/public/js/render/render.js +++ b/public/js/render/render.js @@ -51,7 +51,7 @@ var getPreparedCode = (function () { try { // the try/catch is to catch and preprocessor errors js = editors.javascript.render(); - if (js.trim()) js += '\n\n// created @ ' + two(date.getHours()) + ':' + two(date.getMinutes()) + ':' + two(date.getSeconds()); + if (js.trim()) js += '\n\n//# sourceURL=jsbin-' + two(date.getHours()) + two(date.getMinutes()) + two(date.getSeconds()) + '.js'; } catch (e) { window.console && window.console.error(e.message); } diff --git a/public/js/runner/runner.js b/public/js/runner/runner.js index 8313eb22..5aef09d8 100644 --- a/public/js/runner/runner.js +++ b/public/js/runner/runner.js @@ -92,11 +92,11 @@ var runner = (function () { loopProtect.reset(); // if there's a parse error this will fire - childWindow.onerror = function (msg, url, line) { + childWindow.onerror = function (msg, url, line, col, error) { // show an error on the jsbin console, but not the browser console // (i.e. use _raw), because the browser will throw the native error // which (hopefully) includes a link to the JavaScript VM at that time. - proxyConsole._raw('error', msg + ' (line ' + line + ')'); + proxyConsole._raw('error', error && error.stack ? error.stack : msg + ' (line ' + line + ')'); }; // Write the source out. IE crashes if you have lots of these, so that's