@@ -82,6 +82,11 @@ function isValidObjectMaxDepth(maxDepth) {
8282
8383function minErr ( module , ErrorConstructor ) {
8484 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+
8590 return function ( ) {
8691 var code = arguments [ 0 ] ,
8792 template = arguments [ 1 ] ,
@@ -91,18 +96,22 @@ function minErr(module, ErrorConstructor) {
9196 } ) ,
9297 paramPrefix , i ;
9398
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+
94104 message += template . replace ( / \{ \d + \} / g, function ( match ) {
95105 var index = + match . slice ( 1 , - 1 ) ;
96106
97107 if ( index < templateArgs . length ) {
98- return templateArgs [ index ] ;
108+ return templateArgs [ index ] . replace ( errRegExp , '' ) ;
99109 }
100110
101111 return match ;
102112 } ) ;
103113
104- message += '\nhttps://errors.angularjs.org/"NG_VERSION_FULL"/' +
105- ( module ? module + '/' : '' ) + code ;
114+ message += '\n' + url + ( module ? module + '/' : '' ) + code ;
106115
107116 for ( i = 0 , paramPrefix = '?' ; i < templateArgs . length ; i ++ , paramPrefix = '&' ) {
108117 message += paramPrefix + 'p' + i + '=' + encodeURIComponent ( templateArgs [ i ] ) ;
0 commit comments