aboutsummaryrefslogtreecommitdiffstats
path: root/src/minErr.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/minErr.js')
-rw-r--r--src/minErr.js22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/minErr.js b/src/minErr.js
index 89be9b1b..4ebcf722 100644
--- a/src/minErr.js
+++ b/src/minErr.js
@@ -30,10 +30,21 @@
function minErr(module) {
return function () {
- var prefix = '[' + (module ? module + ':' : '') + arguments[0] + '] ',
+ var code = arguments[0],
+ prefix = '[' + (module ? module + ':' : '') + code + '] ',
template = arguments[1],
templateArgs = arguments,
- message;
+ stringify = function (obj) {
+ if (isFunction(obj)) {
+ return obj.toString().replace(/ \{[\s\S]*$/, '');
+ } else if (isUndefined(obj)) {
+ return 'undefined';
+ } else if (!isString(obj)) {
+ return JSON.stringify(obj);
+ }
+ return obj;
+ },
+ message, i;
message = prefix + template.replace(/\{\d+\}/g, function (match) {
var index = +match.slice(1, -1), arg;
@@ -52,6 +63,13 @@ function minErr(module) {
return match;
});
+ message = message + '\nhttp://errors.angularjs.org/' + version.full + '/' +
+ (module ? module + '/' : '') + code;
+ for (i = 2; i < arguments.length; i++) {
+ message = message + (i == 2 ? '?' : '&') + 'p' + (i-2) + '=' +
+ encodeURIComponent(stringify(arguments[i]));
+ }
+
return new Error(message);
};
}