Slightly more error reporting info - though does not appear to fire at all in firefox...

This commit is contained in:
Remy Sharp 2013-08-10 15:28:28 +01:00
parent 1144825e74
commit ecfae4e9a9
2 changed files with 3 additions and 3 deletions

View File

@ -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);
}

View File

@ -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