Adjust how _.template handles compiled syntax errors for compatibility with Underscore.

Former-commit-id: ba84c5b468938a1be1a1fd0afd31cb83f563e1ca
This commit is contained in:
John-David Dalton
2012-09-03 16:05:12 -07:00
parent e87e46b1b6
commit ffdd79f86b
2 changed files with 9 additions and 11 deletions

View File

@@ -4066,10 +4066,8 @@
try {
result = Function('_', 'return ' + text)(lodash);
} catch(e) {
// defer syntax errors until the compiled template is executed to allow
// examining the `source` property beforehand and for consistency,
// because other template related errors occur at execution
result = function() { throw e; };
e.source = text;
throw e;
}
if (data) {