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/Angular.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/Angular.js')
| -rw-r--r-- | src/Angular.js | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/Angular.js b/src/Angular.js index aefe7ad5..22fb005e 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -215,7 +215,7 @@ function nextUid() { /** * Set or clear the hashkey for an object. - * @param obj object + * @param obj object * @param h the hashkey (!truthy to delete the hashkey) */ function setHashKey(obj, h) { @@ -590,7 +590,10 @@ function isLeafNode (node) { * @returns {*} The copy or updated `destination`, if `destination` was specified. */ function copy(source, destination){ - if (isWindow(source) || isScope(source)) throw Error("Can't copy Window or Scope"); + if (isWindow(source) || isScope(source)) { + throw ngError(43, "Can't copy! Making copies of Window or Scope instances is not supported."); + } + if (!destination) { destination = source; if (source) { @@ -603,7 +606,7 @@ function copy(source, destination){ } } } else { - if (source === destination) throw Error("Can't copy equivalent objects or arrays"); + if (source === destination) throw ngError(44, "Can't copy! Source and destination are identical."); if (isArray(source)) { destination.length = 0; for ( var i = 0; i < source.length; i++) { @@ -1055,7 +1058,7 @@ function bindJQuery() { */ function assertArg(arg, name, reason) { if (!arg) { - throw new Error("Argument '" + (name || '?') + "' is " + (reason || "required")); + throw ngError(45, "Argument '{0}' is {1}", (name || '?'), (reason || "required")); } return arg; } |
