diff options
| author | Igor Minar | 2013-05-24 11:00:14 -0700 |
|---|---|---|
| committer | Vojta Jina | 2013-05-24 17:03:21 -0700 |
| commit | b8ea7f6aba2e675b85826b0bee1f21ddd7b866a5 (patch) | |
| tree | f3b34e25e27d088bec9b698b246d49f86281de36 /src/ng/parse.js | |
| parent | 88eaea8e7bf025a7805a5d20f5d47472e4f26f6f (diff) | |
| download | angular.js-b8ea7f6aba2e675b85826b0bee1f21ddd7b866a5.tar.bz2 | |
feat(ngError): add error message compression and better error messages
- add toThrowNg matcher
Diffstat (limited to 'src/ng/parse.js')
| -rw-r--r-- | src/ng/parse.js | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/ng/parse.js b/src/ng/parse.js index 4616d15d..5af52f60 100644 --- a/src/ng/parse.js +++ b/src/ng/parse.js @@ -123,11 +123,11 @@ function lex(text, csp){ function throwError(error, start, end) { end = end || index; - throw Error("Lexer Error: " + error + " at column" + - (isDefined(start) - ? "s " + start + "-" + index + " [" + text.substring(start, end) + "]" - : " " + end) + - " in expression [" + text + "]."); + var colStr = (isDefined(start) ? + "s " + start + "-" + index + " [" + text.substring(start, end) + "]" + : " " + end); + throw ngError(23, "Lexer Error: {0} at column{1} in expression [{2}].", + error, colStr, text); } function readNumber() { @@ -309,15 +309,14 @@ function parser(text, json, $filter, csp){ /////////////////////////////////// function throwError(msg, token) { - throw Error("Syntax Error: Token '" + token.text + - "' " + msg + " at column " + - (token.index + 1) + " of the expression [" + - text + "] starting at [" + text.substring(token.index) + "]."); + throw ngError(24, + "Syntax Error: Token '{0}' {1} at column {2} of the expression [{3}] starting at [{4}].", + token.text, msg, (token.index + 1), text, text.substring(token.index)); } function peekToken() { if (tokens.length === 0) - throw Error("Unexpected end of expression: " + text); + throw ngError(25, "Unexpected end of expression: {0}", text); return tokens[0]; } @@ -366,7 +365,7 @@ function parser(text, json, $filter, csp){ constant: left.constant && middle.constant && right.constant }); } - + function binaryFn(left, fn, right) { return extend(function(self, locals) { return fn(self, locals, left, right); @@ -471,7 +470,7 @@ function parser(text, json, $filter, csp){ return left; } } - + function logicalOR() { var left = logicalAND(); var token; |
