Skip to content

Instantly share code, notes, and snippets.

@YonasBerhe
Created April 22, 2015 07:14
Show Gist options
  • Save YonasBerhe/46ca8cd84ad158bc1556 to your computer and use it in GitHub Desktop.
Save YonasBerhe/46ca8cd84ad158bc1556 to your computer and use it in GitHub Desktop.
I keep getting this error in my console each time I run my angular app. I don't like Majic
function minErr(module, ErrorConstructor) {
ErrorConstructor = ErrorConstructor || Error;
return function() {
var code = arguments[0],
prefix = '[' + (module ? module + ':' : '') + code + '] ',
template = arguments[1],
templateArgs = arguments,
message, i;
message = prefix + template.replace(/\{\d+\}/g, function(match) {
var index = +match.slice(1, -1), arg;
if (index + 2 < templateArgs.length) {
return toDebugString(templateArgs[index + 2]);
}
return match;
});
message = message + '\nhttp://errors.angularjs.org/1.3.15/' +
(module ? module + '/' : '') + code;
for (i = 2; i < arguments.length; i++) {
message = message + (i == 2 ? '?' : '&') + 'p' + (i - 2) + '=' +
encodeURIComponent(toDebugString(arguments[i]));
}
**return new ErrorConstructor(message);**
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment