Skip to content

Commit

Permalink
fix(minErr): remove references to internals APIs
Browse files Browse the repository at this point in the history
So that we can use minErr with angular-loader, before full angular is loaded.

This also fixes replacing the version during the build.
  • Loading branch information
vojtajina authored and jamesdaily committed Jan 27, 2014
1 parent 671f4e7 commit 40f41e9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/grunt/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ module.exports = {
var mapFile = minFile + '.map';
var mapFileName = mapFile.match(/[^\/]+$/)[0];
var errorFileName = file.replace(/\.js$/, '-errors.json');
var versionNumber = this.getVersion().number;
var versionNumber = this.getVersion().full;
shell.exec(
'java ' +
this.java32flags() + ' ' +
Expand Down
14 changes: 7 additions & 7 deletions src/minErr.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ function minErr(module) {
template = arguments[1],
templateArgs = arguments,
stringify = function (obj) {
if (isFunction(obj)) {
if (typeof obj === 'function') {
return obj.toString().replace(/ \{[\s\S]*$/, '');
} else if (isUndefined(obj)) {
} else if (typeof obj === 'undefined') {
return 'undefined';
} else if (!isString(obj)) {
} else if (typeof obj !== 'string') {
return JSON.stringify(obj);
}
return obj;
Expand All @@ -51,19 +51,19 @@ function minErr(module) {

if (index + 2 < templateArgs.length) {
arg = templateArgs[index + 2];
if (isFunction(arg)) {
if (typeof arg === 'function') {
return arg.toString().replace(/ ?\{[\s\S]*$/, '');
} else if (isUndefined(arg)) {
} else if (typeof arg === 'undefined') {
return 'undefined';
} else if (!isString(arg)) {
} else if (typeof arg !== 'string') {
return toJson(arg);
}
return arg;
}
return match;
});

message = message + '\nhttp://errors.angularjs.org/' + version.full + '/' +
message = message + '\nhttp://errors.angularjs.org/"NG_VERSION_FULL"/' +
(module ? module + '/' : '') + code;
for (i = 2; i < arguments.length; i++) {
message = message + (i == 2 ? '?' : '&') + 'p' + (i-2) + '=' +
Expand Down

0 comments on commit 40f41e9

Please sign in to comment.