From d804bbcd51ec83bee1f4a3ccd42c3bd7eb38a988 Mon Sep 17 00:00:00 2001 From: Brian Ford Date: Thu, 19 Jul 2012 14:07:00 -0700 Subject: feat($interpolate): provide contextual error messages if an exception occurs during interpolation of a string (e.g. name() in "Hello, {{name()}}!" throws an exception) we now print an error message with the expression that was being evaluated when the exception was thrown. --- src/ng/interpolate.js | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'src/ng/interpolate.js') diff --git a/src/ng/interpolate.js b/src/ng/interpolate.js index 149f0c86..dcf05d77 100644 --- a/src/ng/interpolate.js +++ b/src/ng/interpolate.js @@ -52,7 +52,7 @@ function $InterpolateProvider() { }; - this.$get = ['$parse', function($parse) { + this.$get = ['$parse', '$exceptionHandler', function($parse, $exceptionHandler) { var startSymbolLength = startSymbol.length, endSymbolLength = endSymbol.length; @@ -124,18 +124,24 @@ function $InterpolateProvider() { if (!mustHaveExpression || hasInterpolation) { concat.length = length; fn = function(context) { - for(var i = 0, ii = length, part; i