@@ -82,6 +82,11 @@ function isValidObjectMaxDepth(maxDepth) {
82
82
83
83
function minErr ( module , ErrorConstructor ) {
84
84
ErrorConstructor = ErrorConstructor || Error ;
85
+
86
+ var url = 'https://errors.angularjs.org/"NG_VERSION_FULL"/' ;
87
+ var regex = url . replace ( '.' , '\\.' ) + '[\\s\\S]*' ;
88
+ var errRegExp = new RegExp ( regex , 'g' ) ;
89
+
85
90
return function ( ) {
86
91
var code = arguments [ 0 ] ,
87
92
template = arguments [ 1 ] ,
@@ -91,18 +96,22 @@ function minErr(module, ErrorConstructor) {
91
96
} ) ,
92
97
paramPrefix , i ;
93
98
99
+ // A minErr message has two parts: the message itself and the url that contains the
100
+ // encoded message.
101
+ // The message's parameters can contain other error messages which also include error urls.
102
+ // To prevent the messages from getting too long, we strip the error urls from the parameters.
103
+
94
104
message += template . replace ( / \{ \d + \} / g, function ( match ) {
95
105
var index = + match . slice ( 1 , - 1 ) ;
96
106
97
107
if ( index < templateArgs . length ) {
98
- return templateArgs [ index ] ;
108
+ return templateArgs [ index ] . replace ( errRegExp , '' ) ;
99
109
}
100
110
101
111
return match ;
102
112
} ) ;
103
113
104
- message += '\nhttps://errors.angularjs.org/"NG_VERSION_FULL"/' +
105
- ( module ? module + '/' : '' ) + code ;
114
+ message += '\n' + url + ( module ? module + '/' : '' ) + code ;
106
115
107
116
for ( i = 0 , paramPrefix = '?' ; i < templateArgs . length ; i ++ , paramPrefix = '&' ) {
108
117
message += paramPrefix + 'p' + i + '=' + encodeURIComponent ( templateArgs [ i ] ) ;
0 commit comments