better error reporting

This commit is contained in:
guybedford 2013-11-25 15:04:49 +02:00
parent 803dd46734
commit e05a18fc9d
3 changed files with 22 additions and 3 deletions

View File

@ -845,9 +845,16 @@
// carefully scoped eval with given global
var __scopedEval = function(__source, global, __sourceURL, __sourceMappingURL) {
eval('with(global) { (function() { ' + __source + ' \n }).call(global); }'
+ (__sourceURL && !__source.match(/\/\/[@#] ?(sourceURL|sourceMappingURL)=(.+)/)
? '\n//# sourceURL=' + __sourceURL : ''));
try {
eval('with(global) { (function() { ' + __source + ' \n }).call(global); }'
+ (__sourceURL && !__source.match(/\/\/[@#] ?(sourceURL|sourceMappingURL)=(.+)/)
? '\n//# sourceURL=' + __sourceURL : ''));
}
catch(e) {
if (e.name == 'SyntaxError')
e.message = 'Evaluating ' + __sourceURL + '\n\t' + e.message;
throw e;
}
}
})();

View File

@ -71,6 +71,15 @@
return 'Error defining module';
}
},
{
name: 'Error handling',
run: function(complete) {
jspm.import('./tests/error', complete);
},
confirm: function() {
return;
}
},
{
name: 'Global script loading',
run: function(complete) {

3
test/tests/error.js Normal file
View File

@ -0,0 +1,3 @@
setTimeout(function() {
throw 'error';
}, 1000);