Skip to content

Commit d74fa0f

Browse files
committed
Transform error messages
1 parent cfe4229 commit d74fa0f

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

lib/main.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ var isAccessorArray = require( '@stdlib/array-base-assert-is-accessor-array' );
2828
var accessorSetter = require( '@stdlib/array-base-accessor-setter' );
2929
var setter = require( '@stdlib/array-base-setter' );
3030
var dtype = require( '@stdlib/array-dtype' );
31-
var format = require( '@stdlib/string-format' );
31+
var format = require( '@stdlib/error-tools-fmtprodmsg' );
3232

3333

3434
// MAIN //
@@ -72,10 +72,10 @@ function iterator2arrayview( iterator, out ) {
7272
var v;
7373

7474
if ( !isIteratorLike( iterator ) ) {
75-
throw new TypeError( format( 'invalid argument. First argument must be an iterator protocol-compliant object. Value: `%s`.', iterator ) );
75+
throw new TypeError( format( '0Q146', iterator ) );
7676
}
7777
if ( !isCollection( out ) ) {
78-
throw new TypeError( format( 'invalid argument. Second argument must be an array-like object. Value: `%s`.', out ) );
78+
throw new TypeError( format( '0Q12y', out ) );
7979
}
8080
nargs = arguments.length;
8181
if ( nargs === 2 ) {
@@ -113,23 +113,23 @@ function iterator2arrayview( iterator, out ) {
113113
end = arguments[ 3 ];
114114
fcn = arguments[ 4 ];
115115
if ( !isFunction( fcn ) ) {
116-
throw new TypeError( format( 'invalid argument. Fifth argument must be a function. Value: `%s`.', fcn ) );
116+
throw new TypeError( format( '0Q131', fcn ) );
117117
}
118118
}
119119
} else { // nargs > 5
120120
begin = arguments[ 2 ];
121121
end = arguments[ 3 ];
122122
fcn = arguments[ 4 ];
123123
if ( !isFunction( fcn ) ) {
124-
throw new TypeError( format( 'invalid argument. Fifth argument must be a function. Value: `%s`.', fcn ) );
124+
throw new TypeError( format( '0Q131', fcn ) );
125125
}
126126
thisArg = arguments[ 5 ];
127127
}
128128
if ( !isInteger( begin ) ) {
129-
throw new TypeError( format( 'invalid argument. Third argument must be either an integer (starting index) or a function. Value: `%s`.', begin ) );
129+
throw new TypeError( format( '0Q1E2', begin ) );
130130
}
131131
if ( !isInteger( end ) ) {
132-
throw new TypeError( format( 'invalid argument. Fourth argument must be either an integer (ending index) or a function. Value: `%s`.', end ) );
132+
throw new TypeError( format( '0Q1E3', end ) );
133133
}
134134
if ( end < 0 ) {
135135
end = out.length + end;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"@stdlib/assert-is-function": "^0.2.2",
4646
"@stdlib/assert-is-integer": "^0.2.2",
4747
"@stdlib/assert-is-iterator-like": "^0.2.2",
48-
"@stdlib/string-format": "^0.2.2",
48+
"@stdlib/error-tools-fmtprodmsg": "^0.2.2",
4949
"@stdlib/types": "^0.3.2",
5050
"@stdlib/error-tools-fmtprodmsg": "^0.2.2"
5151
},

0 commit comments

Comments
 (0)