From f7e571c4680944b02d88dc02c6601ac9ec573d8a Mon Sep 17 00:00:00 2001 From: Evan You Date: Fri, 8 May 2015 14:05:40 -0400 Subject: [PATCH] suppress simple path getter errors --- src/api/data.js | 4 +--- src/parsers/path.js | 3 ++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/api/data.js b/src/api/data.js index ae60c4aed..543aa8f1a 100644 --- a/src/api/data.js +++ b/src/api/data.js @@ -16,9 +16,7 @@ var filterRE = /[^|]\|[^|]/ exports.$get = function (exp) { var res = expParser.parse(exp) if (res) { - try { - return res.get.call(this, this) - } catch (e) {} + return res.get.call(this, this) } } diff --git a/src/parsers/path.js b/src/parsers/path.js index 778d8e34f..29aa1ad5d 100644 --- a/src/parsers/path.js +++ b/src/parsers/path.js @@ -219,6 +219,7 @@ function formatAccessor(key) { /** * Compiles a getter function with a fixed path. + * The fixed path getter supresses errors. * * @param {Array} path * @return {Function} @@ -226,7 +227,7 @@ function formatAccessor(key) { exports.compileGetter = function (path) { var body = 'return o' + path.map(formatAccessor).join('') - return new Function('o', body) + return new Function('o', 'try {' + body + '} catch (e) {}') } /**