chore(minErr): replace ngError with minErr

This commit is contained in:
Ken Sheedlo 2013-06-07 18:24:30 -07:00 committed by Igor Minar
parent 908071afbf
commit 003861d2fd
35 changed files with 198 additions and 177 deletions

2
angularFiles.js vendored
View file

@ -1,11 +1,11 @@
angularFiles = {
'angularSrc': [
'src/minErr.js',
'src/Angular.js',
'src/loader.js',
'src/AngularPublic.js',
'src/jqLite.js',
'src/apis.js',
'src/ngError.js',
'src/auto/injector.js',

View file

@ -54,6 +54,7 @@ var /** holds major version number for IE or NaN for real browsers */
slice = [].slice,
push = [].push,
toString = Object.prototype.toString,
ngMinErr = minErr('ng'),
_angular = window.angular,
@ -573,7 +574,7 @@ function isLeafNode (node) {
*/
function copy(source, destination){
if (isWindow(source) || isScope(source)) {
throw ngError(43, "Can't copy! Making copies of Window or Scope instances is not supported.");
throw ngMinErr('cpws', "Can't copy! Making copies of Window or Scope instances is not supported.");
}
if (!destination) {
@ -588,7 +589,7 @@ function copy(source, destination){
}
}
} else {
if (source === destination) throw ngError(44, "Can't copy! Source and destination are identical.");
if (source === destination) throw ngMinErr('cpi', "Can't copy! Source and destination are identical.");
if (isArray(source)) {
destination.length = 0;
for ( var i = 0; i < source.length; i++) {
@ -1044,7 +1045,7 @@ function bindJQuery() {
*/
function assertArg(arg, name, reason) {
if (!arg) {
throw ngError(45, "Argument '{0}' is {1}", (name || '?'), (reason || "required"));
throw ngMinErr('areq', "Argument '{0}' is {1}", (name || '?'), (reason || "required"));
}
return arg;
}

View file

@ -42,6 +42,7 @@ var FN_ARGS = /^function\s*[^\(]*\(\s*([^\)]*)\)/m;
var FN_ARG_SPLIT = /,/;
var FN_ARG = /^\s*(_?)(\S+?)\1\s*$/;
var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
var $injectorMinErr = minErr('$injector');
function annotate(fn) {
var $inject,
fnText,
@ -422,7 +423,7 @@ function createInjector(modulesToLoad) {
},
providerInjector = (providerCache.$injector =
createInternalInjector(providerCache, function() {
throw ngError(1, "Unknown provider: {0}", path.join(' <- '));
throw $injectorMinErr('unpr', "Unknown provider: {0}", path.join(' <- '));
})),
instanceCache = {},
instanceInjector = (instanceCache.$injector =
@ -455,7 +456,7 @@ function createInjector(modulesToLoad) {
provider_ = providerInjector.instantiate(provider_);
}
if (!provider_.$get) {
throw ngError(2, "Provider '{0}' must define $get factory method.", name);
throw $injectorMinErr('pget', "Provider '{0}' must define $get factory method.", name);
}
return providerCache[name + providerSuffix] = provider_;
}
@ -538,7 +539,7 @@ function createInjector(modulesToLoad) {
function getService(serviceName) {
if (cache.hasOwnProperty(serviceName)) {
if (cache[serviceName] === INSTANTIATING) {
throw ngError(4, 'Circular dependency found: {0}', path.join(' <- '));
throw $injectorMinErr('cdep', 'Circular dependency found: {0}', path.join(' <- '));
}
return cache[serviceName];
} else {
@ -561,7 +562,7 @@ function createInjector(modulesToLoad) {
for(i = 0, length = $inject.length; i < length; i++) {
key = $inject[i];
if (typeof key !== 'string') {
throw ngError(3, 'Incorrect injection token! Expected service name as string, got {0}', key);
throw $injectorMinErr('itkn', 'Incorrect injection token! Expected service name as string, got {0}', key);
}
args.push(
locals && locals.hasOwnProperty(key)

View file

@ -153,7 +153,7 @@ function JQLite(element) {
}
if (!(this instanceof JQLite)) {
if (isString(element) && element.charAt(0) != '<') {
throw ngError(46, 'Looking up elements via selectors is not supported by jqLite! See: http://docs.angularjs.org/api/angular.element');
throw minErr('jqLite')('nosel', 'Looking up elements via selectors is not supported by jqLite! See: http://docs.angularjs.org/api/angular.element');
}
return new JQLite(element);
}

View file

@ -70,7 +70,7 @@ function setupModuleLoader(window) {
}
return ensure(modules, name, function() {
if (!requires) {
throw ngError(47, "Module '{0}' is not available! You either misspelled the module name or forgot to load it.", name);
throw minErr('$injector')('nomod', "Module '{0}' is not available! You either misspelled the module name or forgot to load it.", name);
}
/** @type {!Array.<Array.<*>>} */

57
src/minErr.js Normal file
View file

@ -0,0 +1,57 @@
'use strict';
/**
* @description
*
* This object provides a utility for producing rich Error messages within
* Angular. It can be called as follows:
*
* var exampleMinErr = minErr('example');
* throw exampleMinErr('one', 'This {0} is {1}', foo, bar);
*
* The above creates an instance of minErr in the example namespace. The
* resulting error will have a namespaced error code of example.one. The
* resulting error will replace {0} with the value of foo, and {1} with the
* value of bar. The object is not restricted in the number of arguments it can
* take.
*
* If fewer arguments are specified than necessary for interpolation, the extra
* interpolation markers will be preserved in the final string.
*
* Since data will be parsed statically during a build step, some restrictions
* are applied with respect to how minErr instances are created and called.
* Instances should have names of the form namespaceMinErr for a minErr created
* using minErr('namespace') . Error codes, namespaces and template strings
* should all be static strings, not variables or general expressions.
*
* @param {string} module The namespace to use for the new minErr instance.
* @returns {function(string, string, ...): Error} instance
*/
function minErr(module) {
return function () {
var prefix = '[' + (module ? module + ':' : '') + arguments[0] + '] ',
template = arguments[1],
templateArgs = arguments,
message;
message = prefix + template.replace(/\{\d+\}/g, function (match) {
var index = +match.slice(1, -1), arg;
if (index + 2 < templateArgs.length) {
arg = templateArgs[index + 2];
if (isFunction(arg)) {
return arg.toString().replace(/ \{[\s\S]*$/, '');
} else if (isUndefined(arg)) {
return 'undefined';
} else if (!isString(arg)) {
return toJson(arg);
}
return arg;
}
return match;
});
return new Error(message);
};
}

View file

@ -28,7 +28,7 @@ function $CacheFactoryProvider() {
function cacheFactory(cacheId, options) {
if (cacheId in caches) {
throw ngError(10, "CacheId '{0}' is already taken!", cacheId);
throw minErr('$cacheFactory')('iid', "CacheId '{0}' is already taken!", cacheId);
}
var size = 0,

View file

@ -138,6 +138,7 @@
* {@link guide/compiler Angular HTML Compiler} section of the Developer Guide.
*/
var $compileMinErr = minErr('$compile');
/**
* @ngdoc service
@ -589,7 +590,7 @@ function $CompileProvider($provide) {
var startNode = node;
do {
if (!node) {
throw ngError(51, "Unterminated attribute, found '{0}' but no matching '{1}' found.", attrStart, attrEnd);
throw $compileMinErr('utrat', "Unterminated attribute, found '{0}' but no matching '{1}' found.", attrStart, attrEnd);
}
if (node.nodeType == 1 /** Element **/) {
if (node.hasAttribute(attrStart)) depth++;
@ -721,7 +722,7 @@ function $CompileProvider($provide) {
compileNode = $template[0];
if ($template.length != 1 || compileNode.nodeType !== 1) {
throw ngError(12, "Template for directive '{0}' must have exactly one root element.", directiveName);
throw $compileMinErr('tplrt', "Template for directive '{0}' must have exactly one root element. {1}", directiveName, '');
}
replaceWith(jqCollection, $compileNode, compileNode);
@ -809,7 +810,7 @@ function $CompileProvider($provide) {
}
value = $element[retrievalMethod]('$' + require + 'Controller');
if (!value && !optional) {
throw ngError(13, "Controller '{0}', required by directive '{1}', can't be found!", require, directiveName);
throw $compileMinErr('ctreq', "Controller '{0}', required by directive '{1}', can't be found!", require, directiveName);
}
return value;
} else if (isArray(require)) {
@ -869,7 +870,7 @@ function $CompileProvider($provide) {
parentSet = parentGet.assign || function() {
// reset the change, or we will throw this exception on every $digest
lastValue = scope[scopeName] = parentGet(parentScope);
throw ngError(14, "Expression '{0}' used with directive '{1}' is non-assignable!",
throw $compileMinErr('noass', "Expression '{0}' used with directive '{1}' is non-assignable!",
attrs[attrName], newIsolateScopeDirective.name);
};
lastValue = scope[scopeName] = parentGet(parentScope);
@ -900,7 +901,7 @@ function $CompileProvider($provide) {
}
default: {
throw ngError(15, "Invalid isolate scope definition for directive '{0}'. Definition: {... {1}: '{2}' ...}",
throw $compileMinErr('iscp', "Invalid isolate scope definition for directive '{0}'. Definition: {... {1}: '{2}' ...}",
newIsolateScopeDirective.name, scopeName, definition);
}
}
@ -1057,7 +1058,7 @@ function $CompileProvider($provide) {
compileNode = $template[0];
if ($template.length != 1 || compileNode.nodeType !== 1) {
throw ngError(16, "Template for directive '{0}' must have exactly one root element. Template: {1}",
throw $compileMinErr('tplrt', "Template for directive '{0}' must have exactly one root element. {1}",
origAsyncDirective.name, templateUrl);
}
@ -1095,7 +1096,7 @@ function $CompileProvider($provide) {
linkQueue = null;
}).
error(function(response, code, headers, config) {
throw ngError(17, 'Failed to load template: {0}', config.url);
throw $compileMinErr('tpload', 'Failed to load template: {0}', config.url);
});
return function delayedNodeLinkFn(ignoreChildLinkFn, scope, node, rootElement, controller) {
@ -1123,7 +1124,7 @@ function $CompileProvider($provide) {
function assertNoDuplicate(what, previousDirective, directive, element) {
if (previousDirective) {
throw ngError(18, 'Multiple directives [{0}, {1}] asking for {2} on: {3}',
throw $compileMinErr('multidir', 'Multiple directives [{0}, {1}] asking for {2} on: {3}',
previousDirective.name, directive.name, what, startingTag(element));
}
}

View file

@ -75,7 +75,7 @@ function $ControllerProvider() {
if (identifier) {
if (!(locals && typeof locals.$scope == 'object')) {
throw ngError(47, "Cannot export controller '{0}' as '{1}'! No $scope object provided via `locals`.", constructor || expression.name, identifier);
throw minErr('$controller')('noscp', "Cannot export controller '{0}' as '{1}'! No $scope object provided via `locals`.", constructor || expression.name, identifier);
}
locals.$scope[identifier] = instance;

View file

@ -475,8 +475,9 @@ function textInputType(scope, element, attr, ctrl, $sniffer, $browser) {
var patternObj = scope.$eval(pattern);
if (!patternObj || !patternObj.test) {
throw ngError(5, 'ngPattern error! Expected {0} to be a RegExp but was {1}. Element: {2}',
pattern, patternObj, startingTag(element));
throw minErr('ngPattern')('noregexp',
'Expected {0} to be a RegExp but was {1}. Element: {2}', pattern,
patternObj, startingTag(element));
}
return validate(patternObj, value);
};
@ -928,8 +929,8 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
ngModelSet = ngModelGet.assign;
if (!ngModelSet) {
throw ngError(6, "ngModel error! Expression '{0}' is non-assignable. Element: {1}", $attr.ngModel,
startingTag($element));
throw minErr('ngModel')('noass', "Expression '{0}' is non-assignable. Element: {1}",
$attr.ngModel, startingTag($element));
}
/**

View file

@ -191,6 +191,7 @@
*/
var ngRepeatDirective = ['$parse', '$animator', function($parse, $animator) {
var NG_REMOVED = '$$NG_REMOVED';
var ngRepeatMinErr = minErr('ngRepeat');
return {
transclude: 'element',
priority: 1000,
@ -204,7 +205,7 @@ var ngRepeatDirective = ['$parse', '$animator', function($parse, $animator) {
hashFnLocals = {$id: hashKey};
if (!match) {
throw ngError(7, "ngRepeat error! Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '{0}'.",
throw ngRepeatMinErr('iexp', "Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '{0}'.",
expression);
}
@ -229,7 +230,7 @@ var ngRepeatDirective = ['$parse', '$animator', function($parse, $animator) {
match = lhs.match(/^(?:([\$\w]+)|\(([\$\w]+)\s*,\s*([\$\w]+)\))$/);
if (!match) {
throw ngError(8, "ngRepeat error! '_item_' in '_item_ in _collection_' should be an identifier or '(_key_, _value_)' expression, but got '{0}'.",
throw ngRepeatMinErr('iidexp', "'_item_' in '_item_ in _collection_' should be an identifier or '(_key_, _value_)' expression, but got '{0}'.",
lhs);
}
valueIdentifier = match[3] || match[1];
@ -291,7 +292,7 @@ var ngRepeatDirective = ['$parse', '$animator', function($parse, $animator) {
if (block && block.startNode) lastBlockMap[block.id] = block;
});
// This is a duplicate and we need to throw an error
throw ngError(50, "ngRepeat error! Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: {0}, Duplicate key: {1}",
throw ngRepeatMinErr('dupes', "Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: {0}, Duplicate key: {1}",
expression, trackById);
} else {
// new never before seen block

View file

@ -300,8 +300,8 @@ var selectDirective = ['$compile', '$parse', function($compile, $parse) {
var match;
if (! (match = optionsExp.match(NG_OPTIONS_REGEXP))) {
throw ngError(9,
"ngOptions error! Expected expression in form of '_select_ (as _label_)? for (_key_,)?_value_ in _collection_' but got '{0}'. Element: {1}",
throw minErr('ngOptions')('iexp',
"Expected expression in form of '_select_ (as _label_)? for (_key_,)?_value_ in _collection_' but got '{0}'. Element: {1}",
optionsExp, startingTag(selectElement));
}

View file

@ -2,7 +2,7 @@ var XHR = window.XMLHttpRequest || function() {
try { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); } catch (e1) {}
try { return new ActiveXObject("Msxml2.XMLHTTP.3.0"); } catch (e2) {}
try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e3) {}
throw ngError(19, "This browser does not support XMLHttpRequest.");
throw minErr('$httpBackend')('noxhr', "This browser does not support XMLHttpRequest.");
};

View file

@ -139,7 +139,7 @@ function $InterpolateProvider() {
return concat.join('');
}
catch(err) {
var newErr = ngError(48, "$interpolate error! Can't interpolate: {0}\n{1}", text, err.toString());
var newErr = minErr('$interpolate')('interr', "Can't interpolate: {0}\n{1}", text, err.toString());
$exceptionHandler(newErr);
}
};

View file

@ -3,6 +3,7 @@
var SERVER_MATCH = /^([^:]+):\/\/(\w+:{0,1}\w*@)?(\{?[\w\.-]*\}?)(:([0-9]+))?(\/[^\?#]*)?(\?([^#]*))?(#(.*))?$/,
PATH_MATCH = /^([^\?#]*)(\?([^#]*))?(#(.*))?$/,
DEFAULT_PORTS = {'http': 80, 'https': 443, 'ftp': 21};
var $locationMinErr = minErr('$location');
/**
@ -95,7 +96,7 @@ function LocationHtml5Url(appBase, basePrefix) {
matchUrl(url, parsed);
var pathUrl = beginsWith(appBaseNoFile, url);
if (!isString(pathUrl)) {
throw ngError(21, '$location error! Invalid url "{0}", missing path prefix "{1}".', url, appBaseNoFile);
throw $locationMinErr('nopp', 'Invalid url "{0}", missing path prefix "{1}".', url, appBaseNoFile);
}
matchAppUrl(pathUrl, parsed);
extend(this, parsed);
@ -157,11 +158,11 @@ function LocationHashbangUrl(appBase, hashPrefix) {
matchUrl(url, this);
var withoutBaseUrl = beginsWith(appBase, url) || beginsWith(appBaseNoFile, url);
if (!isString(withoutBaseUrl)) {
throw ngError(22, '$location error! Invalid url "{0}", does not start with "{1}".', url, appBase);
throw $locationMinErr('istart', 'Invalid url "{0}", does not start with "{1}".', url, appBase);
}
var withoutHashUrl = withoutBaseUrl.charAt(0) == '#' ? beginsWith(hashPrefix, withoutBaseUrl) : withoutBaseUrl;
if (!isString(withoutHashUrl)) {
throw ngError(49, '$location error! Invalid url "{0}", missing hash prefix "{1}".', url, hashPrefix);
throw $locationMinErr('nohash', 'Invalid url "{0}", missing hash prefix "{1}".', url, hashPrefix);
}
matchAppUrl(withoutHashUrl, this);
this.$$compose();

View file

@ -36,6 +36,7 @@ var OPERATORS = {
'!':function(self, locals, a){return !a(self, locals);}
};
var ESCAPE = {"n":"\n", "f":"\f", "r":"\r", "t":"\t", "v":"\v", "'":"'", '"':'"'};
var $parseMinErr = minErr('$parse');
function lex(text, csp){
var tokens = [],
@ -126,7 +127,7 @@ function lex(text, csp){
var colStr = (isDefined(start) ?
"s " + start + "-" + index + " [" + text.substring(start, end) + "]"
: " " + end);
throw ngError(23, "Lexer Error: {0} at column{1} in expression [{2}].",
throw $parseMinErr('lexerr', "Lexer Error: {0} at column{1} in expression [{2}].",
error, colStr, text);
}
@ -309,14 +310,14 @@ function parser(text, json, $filter, csp){
///////////////////////////////////
function throwError(msg, token) {
throw ngError(24,
throw $parseMinErr('syntax',
"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 ngError(25, "Unexpected end of expression: {0}", text);
throw $parseMinErr('ueoe', "Unexpected end of expression: {0}", text);
return tokens[0];
}

View file

@ -60,6 +60,7 @@
*/
function $RootScopeProvider(){
var TTL = 10;
var $rootScopeMinErr = minErr('$rootScope');
this.digestTtl = function(value) {
if (arguments.length) {
@ -556,7 +557,7 @@ function $RootScopeProvider(){
if(dirty && !(ttl--)) {
clearPhase();
throw ngError(27,
throw $rootScopeMinErr('infdig',
'{0} $digest() iterations reached. Aborting!\nWatchers fired in the last 5 iterations: {1}',
TTL, toJson(watchLog));
}
@ -920,7 +921,7 @@ function $RootScopeProvider(){
function beginPhase(phase) {
if ($rootScope.$$phase) {
throw ngError(28, '{0} already in progress', $rootScope.$$phase);
throw $rootScopeMinErr('inprog', '{0} already in progress', $rootScope.$$phase);
}
$rootScope.$$phase = phase;

View file

@ -1,47 +0,0 @@
'use strict';
/**
* @description
*
* This object extends the error class and provides interpolation capability
* to make it easier to write and read Error messages within Angular. It can
* be called as follows:
*
* throw ngError(13, 'This {0} is {1}', foo, bar);
*
* The above will replace {0} with the value of foo, and {1} with the value of
* bar. The object is not restricted in the number of arguments it can take.
*
* If fewer arguments are specified than necessary for interpolation, the extra
* interpolation markers will be preserved in the final string.
*
* @param {...} arguments The first argument to this object is the error
* number, the second argument the message with templated points for
* Interpolation (of the for {0} for the first, {1} for the second and
* so on). The second argument onwards are interpolated into the error
* message string in order.
*/
function ngError() {
var message = '[NgErr' + arguments[0] + '] ' + arguments[1],
i = 0,
l = arguments.length - 2,
curlyRegexp, arg;
for (; i < l; i++) {
curlyRegexp = new RegExp("\\{" + i + "\\}", "gm");
arg = arguments[i + 2];
if (isFunction(arg)) {
arg = arg.toString().replace(/ \{[\s\S]*$/, '');
} else if (!isString(arg)) {
arg = toJson(arg);
}
message = message.replace(curlyRegexp, arg);
}
// even if we are called as constructor we can bypass the new ngError instance and return
// an instance of a real Error that contains correct stack info + extra frame for ngError call
// TODO(i): can we rewrite the stack string to remove ngError frame?
return new Error(message);
}

View file

@ -85,20 +85,20 @@ describe('angular', function() {
it('should throw an exception if a Scope is being copied', inject(function($rootScope) {
expect(function() { copy($rootScope.$new()); }).
toThrow("[NgErr43] Can't copy! Making copies of Window or Scope instances is not supported.");
toThrow("[ng:cpws] Can't copy! Making copies of Window or Scope instances is not supported.");
}));
it('should throw an exception if a Window is being copied', function() {
expect(function() { copy(window); }).
toThrow("[NgErr43] Can't copy! Making copies of Window or Scope instances is not supported.");
toThrow("[ng:cpws] Can't copy! Making copies of Window or Scope instances is not supported.");
});
it('should throw an exception when source and destination are equivalent', function() {
var src, dst;
src = dst = {key: 'value'};
expect(function() { copy(src, dst); }).toThrow("[NgErr44] Can't copy! Source and destination are identical.");
expect(function() { copy(src, dst); }).toThrow("[ng:cpi] Can't copy! Source and destination are identical.");
src = dst = [2, 4];
expect(function() { copy(src, dst); }).toThrow("[NgErr44] Can't copy! Source and destination are identical.");
expect(function() { copy(src, dst); }).toThrow("[ng:cpi] Can't copy! Source and destination are identical.");
});
it('should not copy the private $$hashKey', function() {
@ -582,7 +582,7 @@ describe('angular', function() {
expect(function() {
angularInit(appElement, bootstrap);
}).toThrow("[NgErr47] Module 'doesntexist' is not available! You either misspelled the module name or forgot to load it.");
}).toThrow("[$injector:nomod] Module 'doesntexist' is not available! You either misspelled the module name or forgot to load it.");
});
});
@ -726,7 +726,7 @@ describe('angular', function() {
expect(function() {
angular.bootstrap(element, ['doesntexist']);
}).toThrow("[NgErr47] Module 'doesntexist' is not available! You either misspelled the module name or forgot to load it.");
}).toThrow("[$injector:nomod] Module 'doesntexist' is not available! You either misspelled the module name or forgot to load it.");
expect(element.html()).toBe('{{1+2}}');
dealoc(element);
@ -785,7 +785,7 @@ describe('angular', function() {
expect(function() {
element.injector().get('foo');
}).toThrow('[NgErr1] Unknown provider: fooProvider <- foo');
}).toThrow('[$injector:unpr] Unknown provider: fooProvider <- foo');
expect(element.injector().get('$http')).toBeDefined();
});

View file

@ -175,7 +175,7 @@ describe('Binder', function() {
$rootScope.error['throw'] = function() {throw 'MyError';};
errorLogs.length = 0;
$rootScope.$apply();
expect(errorLogs.shift().message).toBe("[NgErr48] $interpolate error! Can't interpolate: {{error.throw()}}\nMyError");
expect(errorLogs.shift().message).toBe("[$interpolate:interr] Can't interpolate: {{error.throw()}}\nMyError");
$rootScope.error['throw'] = function() {return 'ok';};
$rootScope.$apply();

View file

@ -70,7 +70,7 @@ describe('injector', function() {
it('should provide useful message if no provider', function() {
expect(function() {
injector.get('idontexist');
}).toThrow("[NgErr1] Unknown provider: idontexistProvider <- idontexist");
}).toThrow("[$injector:unpr] Unknown provider: idontexistProvider <- idontexist");
});
@ -79,7 +79,7 @@ describe('injector', function() {
providers('b', function(a) {return 2;});
expect(function() {
injector.get('b');
}).toThrow("[NgErr1] Unknown provider: idontexistProvider <- idontexist <- a <- b");
}).toThrow("[$injector:unpr] Unknown provider: idontexistProvider <- idontexist <- a <- b");
});
@ -127,10 +127,10 @@ describe('injector', function() {
it('should fail with errors if not function or array', function() {
expect(function() {
injector.invoke({});
}).toThrow("[NgErr45] Argument 'fn' is not a function, got Object");
}).toThrow("[ng:areq] Argument 'fn' is not a function, got Object");
expect(function() {
injector.invoke(['a', 123], {});
}).toThrow("[NgErr45] Argument 'fn' is not a function, got number");
}).toThrow("[ng:areq] Argument 'fn' is not a function, got number");
});
});
@ -268,7 +268,7 @@ describe('injector', function() {
it('should error on invalid module name', function() {
expect(function() {
createInjector(['IDontExist'], {});
}).toThrow("[NgErr47] Module 'IDontExist' is not available! You either misspelled the module name or forgot to load it.");
}).toThrow("[$injector:nomod] Module 'IDontExist' is not available! You either misspelled the module name or forgot to load it.");
});
@ -552,7 +552,7 @@ describe('injector', function() {
createInjector([
{}
], {});
}).toThrow("[NgErr45] Argument 'module' is not a function, got Object");
}).toThrow("[ng:areq] Argument 'module' is not a function, got Object");
});
@ -569,7 +569,7 @@ describe('injector', function() {
angular.module('TestModule', [], function(xyzzy) {});
expect(function() {
createInjector(['TestModule']);
}).toThrow('[NgErr1] Unknown provider: xyzzy from TestModule');
}).toThrow('[$injector:unpr] Unknown provider: xyzzy from TestModule');
});
@ -577,7 +577,7 @@ describe('injector', function() {
function myModule(xyzzy){}
expect(function() {
createInjector([myModule]);
}).toThrow('[NgErr1] Unknown provider: xyzzy from ' + myModule);
}).toThrow('[$injector:unpr] Unknown provider: xyzzy from ' + myModule);
});
@ -585,7 +585,7 @@ describe('injector', function() {
function myModule(xyzzy){}
expect(function() {
createInjector([['xyzzy', myModule]]);
}).toThrow('[NgErr1] Unknown provider: xyzzy from ' + myModule);
}).toThrow('[$injector:unpr] Unknown provider: xyzzy from ' + myModule);
});
@ -595,7 +595,7 @@ describe('injector', function() {
$provide.factory('service', function(service){});
return function(service) {}
}])
}).toThrow("[NgErr4] Circular dependency found: service");
}).toThrow("[$injector:cdep] Circular dependency found: service");
});
@ -606,7 +606,7 @@ describe('injector', function() {
$provide.factory('b', function(a){});
return function(a) {}
}])
}).toThrow('[NgErr4] Circular dependency found: b <- a');
}).toThrow('[$injector:cdep] Circular dependency found: b <- a');
});
});
});
@ -696,7 +696,7 @@ describe('injector', function() {
it('should throw usefull error on wrong argument type]', function() {
expect(function() {
$injector.invoke({});
}).toThrow("[NgErr45] Argument 'fn' is not a function, got Object");
}).toThrow("[ng:areq] Argument 'fn' is not a function, got Object");
});
});
@ -783,7 +783,7 @@ describe('injector', function() {
}]);
expect(function() {
$injector.get('nameProvider');
}).toThrow("[NgErr1] Unknown provider: nameProviderProvider <- nameProvider");
}).toThrow("[$injector:unpr] Unknown provider: nameProviderProvider <- nameProvider");
});
@ -791,7 +791,7 @@ describe('injector', function() {
var $injector = createInjector([]);
expect(function() {
$injector.get('$provide').value('a', 'b');
}).toThrow("[NgErr1] Unknown provider: $provideProvider <- $provide");
}).toThrow("[$injector:unpr] Unknown provider: $provideProvider <- $provide");
});
@ -801,7 +801,7 @@ describe('injector', function() {
createInjector([function($provide) {
$provide.value('name', 'angular')
}, instanceLookupInModule]);
}).toThrow('[NgErr1] Unknown provider: name from ' + String(instanceLookupInModule));
}).toThrow('[$injector:unpr] Unknown provider: name from ' + String(instanceLookupInModule));
});
});
});

View file

@ -68,6 +68,6 @@ describe('module loader', function() {
it('should complain of no module', function() {
expect(function() {
window.angular.module('dontExist');
}).toThrow("[NgErr47] Module 'dontExist' is not available! You either misspelled the module name or forgot to load it.");
}).toThrow("[$injector:nomod] Module 'dontExist' is not available! You either misspelled the module name or forgot to load it.");
});
});

View file

@ -149,9 +149,8 @@ beforeEach(function() {
angular.element(this.actual).hasClass(clazz);
},
toThrowNg: function(expected) {
return jasmine.Matchers.prototype.toThrow.call(this, new RegExp('\\[NgErr\\d*\\] ' +
expected.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&")));
toThrowMatching: function(expected) {
return jasmine.Matchers.prototype.toThrow.call(this, expected);
}
});
});

View file

@ -1,24 +1,25 @@
'use strict';
describe('ngError', function() {
describe('minErr', function () {
var supportStackTraces = function() {
var e = new Error();
return isDefined(e.stack);
};
var emptyTestError = minErr(),
testError = minErr('test');
it('should return an Error instance', function() {
var myError = ngError();
it('should return an Error factory', function() {
var myError = testError('test', 'Oops');
expect(myError instanceof Error).toBe(true);
});
it('should generate stack trace at the frame where ngError was called', function() {
it('should generate stack trace at the frame where the minErr instance was called', function() {
var myError;
function someFn() {
function nestedFn() {
myError = ngError(0, "I fail!");
myError = testError('fail', "I fail!");
}
nestedFn();
}
@ -31,13 +32,11 @@ describe('ngError', function() {
expect(myError.stack).toMatch(/^[.\s\S]+nestedFn[.\s\S]+someFn.+/);
});
it('should interpolate string arguments without quotes', function() {
var myError = ngError(26, 'This {0} is "{1}"', 'foo', 'bar');
expect(myError.message).toBe('[NgErr26] This foo is "bar"');
var myError = testError('1', 'This {0} is "{1}"', 'foo', 'bar');
expect(myError.message).toBe('[test:1] This foo is "bar"');
});
it('should interpolate non-string arguments', function() {
var arr = [1, 2, 3],
obj = {a: 123, b: 'baar'},
@ -45,21 +44,20 @@ describe('ngError', function() {
namedFn = function foo(something) { return something; },
myError;
myError = ngError(26, 'arr: {0}; obj: {1}; anonFn: {2}; namedFn: {3}',
myError = testError('26', 'arr: {0}; obj: {1}; anonFn: {2}; namedFn: {3}',
arr, obj, anonFn, namedFn);
expect(myError.message).toContain('[NgErr26] arr: [1,2,3]; obj: {"a":123,"b":"baar"};');
expect(myError.message).toContain('[test:26] arr: [1,2,3]; obj: {"a":123,"b":"baar"};');
// IE does not add space after "function"
expect(myError.message).toMatch(/anonFn: function\s?\(something\);/);
expect(myError.message).toContain('namedFn: function foo(something)');
});
it('should not suppress falsy objects', function() {
var myError = ngError(26, 'false: {0}; zero: {1}; null: {2}; undefined: {3}; emptyStr: {4}',
var myError = testError('26', 'false: {0}; zero: {1}; null: {2}; undefined: {3}; emptyStr: {4}',
false, 0, null, undefined, '');
expect(myError.message).
toBe('[NgErr26] false: false; zero: 0; null: null; undefined: undefined; emptyStr: ');
toBe('[test:26] false: false; zero: 0; null: null; undefined: undefined; emptyStr: ');
});
@ -67,14 +65,21 @@ describe('ngError', function() {
// this way we can easily see if we are passing fewer args than needed
var foo = 'Fooooo',
myError = ngError(26, 'This {0} is {1} on {2}', foo);
myError = testError('26', 'This {0} is {1} on {2}', foo);
expect(myError.message).toBe('[NgErr26] This Fooooo is {1} on {2}');
expect(myError.message).toBe('[test:26] This Fooooo is {1} on {2}');
});
it('should pass through the message if no interpolation is needed', function() {
var myError = ngError(26, 'Something horrible happened!');
expect(myError.message).toBe('[NgErr26] Something horrible happened!');
var myError = testError('26', 'Something horrible happened!');
expect(myError.message).toBe('[test:26] Something horrible happened!');
});
it('should include a namespace in the message only if it is namespaced', function () {
var myError = emptyTestError('26', 'This is a {0}', 'Foo');
var myNamespacedError = testError('26', 'That is a {0}', 'Bar');
expect(myError.message).toBe('[26] This is a Foo');
expect(myNamespacedError.message).toBe('[test:26] That is a Bar');
});
});

View file

@ -768,6 +768,6 @@ describe("$animator", function() {
expect(function() {
var animate = $animator($rootScope, { ngAnimate: ':' });
animate.enter();
}).toThrow("[NgErr24] Syntax Error: Token ':' not a primary expression at column 1 of the expression [:] starting at [:].");
}).toThrow("[$parse:syntax] Syntax Error: Token ':' not a primary expression at column 1 of the expression [:] starting at [:].");
}));
});

View file

@ -15,7 +15,7 @@ describe('$cacheFactory', function() {
it('should complain if the cache id is being reused', inject(function($cacheFactory) {
$cacheFactory('cache1');
expect(function() { $cacheFactory('cache1'); }).
toThrow("[NgErr10] CacheId 'cache1' is already taken!");
toThrow("[$cacheFactory:iid] CacheId 'cache1' is already taken!");
}));

View file

@ -632,11 +632,11 @@ describe('$compile', function() {
inject(function($compile) {
expect(function() {
$compile('<p no-root-elem></p>');
}).toThrow("[NgErr12] Template for directive 'noRootElem' must have exactly one root element.");
}).toThrow("[$compile:tplrt] Template for directive 'noRootElem' must have exactly one root element. ");
expect(function() {
$compile('<p multi-root-elem></p>');
}).toThrow("[NgErr12] Template for directive 'multiRootElem' must have exactly one root element.");
}).toThrow("[$compile:tplrt] Template for directive 'multiRootElem' must have exactly one root element. ");
// ws is ok
expect(function() {
@ -985,7 +985,7 @@ describe('$compile', function() {
expect(function() {
$httpBackend.flush();
}).toThrow('[NgErr17] Failed to load template: hello.html');
}).toThrow('[$compile:tpload] Failed to load template: hello.html');
expect(sortedHtml(element)).toBe('<div><b class="hello"></b></div>');
}
));
@ -1005,7 +1005,7 @@ describe('$compile', function() {
inject(function($compile){
expect(function() {
$compile('<div><div class="sync async"></div></div>');
}).toThrow('[NgErr18] Multiple directives [sync, async] asking for template on: '+
}).toThrow('[$compile:multidir] Multiple directives [sync, async] asking for template on: '+
'<div class="sync async">');
});
});
@ -1189,14 +1189,14 @@ describe('$compile', function() {
$compile('<p template></p>');
$rootScope.$digest();
expect($exceptionHandler.errors.pop().message).
toBe("[NgErr16] Template for directive 'template' must have exactly one root element. Template: template.html");
toBe("[$compile:tplrt] Template for directive 'template' must have exactly one root element. template.html");
// multi root
$templateCache.put('template.html', '<div></div><div></div>');
$compile('<p template></p>');
$rootScope.$digest();
expect($exceptionHandler.errors.pop().message).
toBe("[NgErr16] Template for directive 'template' must have exactly one root element. Template: template.html");
toBe("[$compile:tplrt] Template for directive 'template' must have exactly one root element. template.html");
// ws is ok
$templateCache.put('template.html', ' <div></div> \n');
@ -1456,7 +1456,7 @@ describe('$compile', function() {
function($rootScope, $compile) {
expect(function(){
$compile('<div class="iscope-a; scope-b"></div>');
}).toThrow('[NgErr18] Multiple directives [iscopeA, scopeB] asking for isolated scope on: ' +
}).toThrow('[$compile:multidir] Multiple directives [iscopeA, scopeB] asking for isolated scope on: ' +
'<div class="iscope-a; scope-b ng-isolate-scope ng-scope">');
})
);
@ -1466,7 +1466,7 @@ describe('$compile', function() {
function($rootScope, $compile) {
expect(function(){
$compile('<div class="iscope-a; iscope-b"></div>');
}).toThrow('[NgErr18] Multiple directives [iscopeA, iscopeB] asking for isolated scope on: ' +
}).toThrow('[$compile:multidir] Multiple directives [iscopeA, iscopeB] asking for isolated scope on: ' +
'<div class="iscope-a; iscope-b ng-isolate-scope ng-scope">');
})
);
@ -2074,7 +2074,7 @@ describe('$compile', function() {
componentScope.ref = 'ignore me';
expect($rootScope.$apply).
toThrow("[NgErr14] Expression ''hello ' + name' used with directive 'myComponent' is non-assignable!");
toThrow("[$compile:noass] Expression ''hello ' + name' used with directive 'myComponent' is non-assignable!");
expect(componentScope.ref).toBe('hello world');
// reset since the exception was rethrown which prevented phase clearing
$rootScope.$$phase = null;
@ -2150,7 +2150,7 @@ describe('$compile', function() {
it('should throw on unknown definition', inject(function() {
expect(function() {
compile('<div><span bad-declaration>');
}).toThrow("[NgErr15] Invalid isolate scope definition for directive 'badDeclaration'. Definition: {... attr: 'xxx' ...}");
}).toThrow("[$compile:iscp] Invalid isolate scope definition for directive 'badDeclaration'. Definition: {... attr: 'xxx' ...}");
}));
it('should expose a $$isolateBindings property onto the scope', inject(function() {
@ -2247,7 +2247,7 @@ describe('$compile', function() {
inject(function(log, $compile, $rootScope) {
expect(function() {
$compile('<div main><div dep></div></div>')($rootScope);
}).toThrow("[NgErr13] Controller 'main', required by directive 'dep', can't be found!");
}).toThrow("[$compile:ctreq] Controller 'main', required by directive 'dep', can't be found!");
});
});
@ -2434,7 +2434,7 @@ describe('$compile', function() {
inject(function($compile) {
expect(function() {
$compile('<div class="first second"></div>');
}).toThrow('[NgErr18] Multiple directives [first, second] asking for transclusion on: ' +
}).toThrow('[$compile:multidir] Multiple directives [first, second] asking for transclusion on: ' +
'<div class="first second ng-isolate-scope ng-scope">');
});
});
@ -2816,7 +2816,7 @@ describe('$compile', function() {
'<div>' +
'<span foo-start></span>' +
'</div>');
}).toThrow("[NgErr51] Unterminated attribute, found 'foo-start' but no matching 'foo-end' found.");
}).toThrow("[$compile:utrat] Unterminated attribute, found 'foo-start' but no matching 'foo-end' found.");
});
});
@ -2834,7 +2834,7 @@ describe('$compile', function() {
'<div>' +
'<span foo-start><span foo-end></span></span>' +
'</div>');
}).toThrow("[NgErr51] Unterminated attribute, found 'foo-start' but no matching 'foo-end' found.");
}).toThrow("[$compile:utrat] Unterminated attribute, found 'foo-start' but no matching 'foo-end' found.");
});
});

View file

@ -131,7 +131,7 @@ describe('$controller', function() {
expect(function() {
$controller('a.b.FooCtrl as foo');
}).toThrow("[NgErr47] Cannot export controller 'a.b.FooCtrl' as 'foo'! No $scope object provided via `locals`.");
}).toThrow("[$controller:noscp] Cannot export controller 'a.b.FooCtrl' as 'foo'! No $scope object provided via `locals`.");
});
});

View file

@ -43,7 +43,7 @@ describe('NgModelController', function() {
}
expect(exception.message).
toMatch(/^\[NgErr6\] ngModel error! Expression '1\+2' is non\-assignable\. Element: <input( value="")? ng-model="1\+2">$/);
toMatch(/^\[ngModel:noass\] Expression '1\+2' is non\-assignable\. Element: <input( value="")? ng-model="1\+2">$/);
}));
@ -457,7 +457,7 @@ describe('input', function() {
expect(function() {
compileInput('<input type="text" ng-model="throw \'\'">');
scope.$digest();
}).toThrow("[NgErr24] Syntax Error: Token '''' is an unexpected token at column 7 of the expression [throw ''] starting at [''].");
}).toThrow("[$parse:syntax] Syntax Error: Token '''' is an unexpected token at column 7 of the expression [throw ''] starting at [''].");
});
@ -552,7 +552,7 @@ describe('input', function() {
expect(function() {
compileInput('<input type="text" ng-model="foo" ng-pattern="fooRegexp" />');
scope.$apply();
}).toThrowNg('ngPattern error! Expected fooRegexp to be a RegExp but was undefined.');
}).toThrowMatching(/^\[ngPattern:noregexp\] Expected fooRegexp to be a RegExp but was/);
});
});

View file

@ -269,7 +269,7 @@ describe('ngRepeat', function() {
element = jqLite('<ul><li ng-repeat="i dont parse"></li></ul>');
$compile(element)(scope);
expect($exceptionHandler.errors.shift()[0].message).
toBe("[NgErr7] ngRepeat error! Expected expression in form of '_item_ in _collection_[ track by _id_]' but got 'i dont parse'.");
toBe("[ngRepeat:iexp] Expected expression in form of '_item_ in _collection_[ track by _id_]' but got 'i dont parse'.");
});
@ -277,7 +277,7 @@ describe('ngRepeat', function() {
element = jqLite('<ul><li ng-repeat="i dont parse in foo"></li></ul>');
$compile(element)(scope);
expect($exceptionHandler.errors.shift()[0].message).
toBe("[NgErr8] ngRepeat error! '_item_' in '_item_ in _collection_' should be an identifier or '(_key_, _value_)' expression, but got 'i dont parse'.");
toBe("[ngRepeat:iidexp] '_item_' in '_item_ in _collection_' should be an identifier or '(_key_, _value_)' expression, but got 'i dont parse'.");
});
@ -481,7 +481,7 @@ describe('ngRepeat', function() {
scope.items = [a, a, a];
scope.$digest();
expect($exceptionHandler.errors.shift().message).
toEqual("[NgErr50] ngRepeat error! Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: item in items, Duplicate key: object:003");
toEqual("[ngRepeat:dupes] Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: item in items, Duplicate key: object:003");
// recover
scope.items = [a];
@ -501,7 +501,7 @@ describe('ngRepeat', function() {
scope.items = [d, d, d];
scope.$digest();
expect($exceptionHandler.errors.shift().message).
toEqual("[NgErr50] ngRepeat error! Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: item in items, Duplicate key: object:009");
toEqual("[ngRepeat:dupes] Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: item in items, Duplicate key: object:009");
// recover
scope.items = [a];

View file

@ -493,9 +493,8 @@ describe('select', function() {
it('should throw when not formated "? for ? in ?"', function() {
expect(function() {
compile('<select ng-model="selected" ng-options="i dont parse"></select>');
}).toThrowNg("ngOptions error! Expected expression in form of '_select_ (as _label_)? for (_key_,)?_value_ in" +
" _collection_' but got 'i dont parse'.");
compile('<select ng-model="selected" ng-options="i dont parse"></select>');
}).toThrowMatching(/^\[ngOptions:iexp\] Expected expression in form of/);
});

View file

@ -32,7 +32,7 @@ describe('$interpolate', function() {
};
expect(function () {
$interpolate('{{err()}}')($rootScope);
}).toThrow("[NgErr48] $interpolate error! Can't interpolate: {{err()}}\nError: oops");
}).toThrow("[$interpolate:interr] Can't interpolate: {{err()}}\nError: oops");
}));
it('should stop interpolation when encountering an exception', inject(function($interpolate, $compile, $rootScope) {
@ -43,7 +43,7 @@ describe('$interpolate', function() {
$compile(dom)($rootScope);
expect(function () {
$rootScope.$apply();
}).toThrow("[NgErr48] $interpolate error! Can't interpolate: {{err()}}\nError: oops");
}).toThrow("[$interpolate:interr] Can't interpolate: {{err()}}\nError: oops");
expect(dom[0].innerHTML).toEqual('2');
expect(dom[1].innerHTML).toEqual('{{err()}}');
expect(dom[2].innerHTML).toEqual('{{1 + 2}}');

View file

@ -190,7 +190,7 @@ describe('$location', function() {
expect(function() {
url.$$parse('http://other.server.org/path#/path');
}).toThrow('[NgErr21] $location error! Invalid url "http://other.server.org/path#/path", missing path prefix "http://server.org/base/".');
}).toThrow('[$location:nopp] Invalid url "http://other.server.org/path#/path", missing path prefix "http://server.org/base/".');
});
@ -199,7 +199,7 @@ describe('$location', function() {
expect(function() {
url.$$parse('http://server.org/path#/path');
}).toThrow('[NgErr21] $location error! Invalid url "http://server.org/path#/path", missing path prefix "http://server.org/base/".');
}).toThrow('[$location:nopp] Invalid url "http://server.org/path#/path", missing path prefix "http://server.org/base/".');
});
@ -312,14 +312,14 @@ describe('$location', function() {
it('should throw error when invalid server url given', function() {
expect(function() {
url.$$parse('http://server.org/path#/path');
}).toThrow('[NgErr22] $location error! Invalid url "http://server.org/path#/path", does not start with "http://www.server.org:1234/base".');
}).toThrow('[$location:istart] Invalid url "http://server.org/path#/path", does not start with "http://www.server.org:1234/base".');
});
it('should throw error when invalid hashbang prefix given', function() {
expect(function() {
url.$$parse('http://www.server.org:1234/base#/path');
}).toThrow('[NgErr49] $location error! Invalid url "http://www.server.org:1234/base#/path", missing hash prefix "#!".');
}).toThrow('[$location:nohash] Invalid url "http://www.server.org:1234/base#/path", missing hash prefix "#!".');
});

View file

@ -156,11 +156,11 @@ describe('parser', function() {
it('should throws exception for invalid exponent', function() {
expect(function() {
lex("0.5E-");
}).toThrow(new Error('[NgErr23] Lexer Error: Invalid exponent at column 4 in expression [0.5E-].'));
}).toThrow(new Error('[$parse:lexerr] Lexer Error: Invalid exponent at column 4 in expression [0.5E-].'));
expect(function() {
lex("0.5E-A");
}).toThrow(new Error('[NgErr23] Lexer Error: Invalid exponent at column 4 in expression [0.5E-A].'));
}).toThrow(new Error('[$parse:lexerr] Lexer Error: Invalid exponent at column 4 in expression [0.5E-A].'));
});
it('should tokenize number starting with a dot', function() {
@ -171,7 +171,7 @@ describe('parser', function() {
it('should throw error on invalid unicode', function() {
expect(function() {
lex("'\\u1''bla'");
}).toThrow(new Error("[NgErr23] Lexer Error: Invalid unicode escape [\\u1''b] at column 2 in expression ['\\u1''bla']."));
}).toThrow(new Error("[$parse:lexerr] Lexer Error: Invalid unicode escape [\\u1''b] at column 2 in expression ['\\u1''bla']."));
});
});
@ -304,7 +304,7 @@ describe('parser', function() {
expect(function() {
scope.$eval("1|nonexistent");
}).toThrow(new Error("[NgErr1] Unknown provider: nonexistentFilterProvider <- nonexistentFilter"));
}).toThrow(new Error("[$injector:unpr] Unknown provider: nonexistentFilterProvider <- nonexistentFilter"));
scope.offset = 3;
expect(scope.$eval("'abcd'|substring:1:offset")).toEqual("bc");
@ -492,7 +492,7 @@ describe('parser', function() {
it('should throw exception on non-closed bracket', function() {
expect(function() {
scope.$eval('[].count(');
}).toThrow('[NgErr25] Unexpected end of expression: [].count(');
}).toThrow('[$parse:ueoe] Unexpected end of expression: [].count(');
});
it('should evaluate double negation', function() {

View file

@ -215,7 +215,7 @@ describe('Scope', function() {
expect(function() {
$rootScope.$digest();
}).toThrow('[NgErr27] 100 $digest() iterations reached. Aborting!\n'+
}).toThrow('[$rootScope:infdig] 100 $digest() iterations reached. Aborting!\n'+
'Watchers fired in the last 5 iterations: ' +
'[["a; newVal: 96; oldVal: 95","b; newVal: 97; oldVal: 96"],' +
'["a; newVal: 97; oldVal: 96","b; newVal: 98; oldVal: 97"],' +
@ -299,7 +299,7 @@ describe('Scope', function() {
$rootScope.$watch('name', function() {
expect(function() {
$rootScope.$digest();
}).toThrow('[NgErr28] $digest already in progress');
}).toThrow('[$rootScope:inprog] $digest already in progress');
callCount++;
});
$rootScope.name = 'a';
@ -759,7 +759,7 @@ describe('Scope', function() {
$rootScope.$apply(function() {
$rootScope.$apply();
});
}).toThrow('[NgErr28] $apply already in progress');
}).toThrow('[$rootScope:inprog] $apply already in progress');
}));
@ -771,7 +771,7 @@ describe('Scope', function() {
$rootScope.$apply();
});
});
}).toThrow('[NgErr28] $digest already in progress');
}).toThrow('[$rootScope:inprog] $digest already in progress');
}));
@ -781,7 +781,7 @@ describe('Scope', function() {
childScope1.$watch('x', function() {
childScope1.$apply();
});
expect(function() { childScope1.$apply(); }).toThrow('[NgErr28] $digest already in progress');
expect(function() { childScope1.$apply(); }).toThrow('[$rootScope:inprog] $digest already in progress');
}));
@ -798,7 +798,7 @@ describe('Scope', function() {
expect(function() { childScope2.$apply(function() {
childScope2.x = 'something';
}); }).toThrow('[NgErr28] $digest already in progress');
}); }).toThrow('[$rootScope:inprog] $digest already in progress');
}));
});
});