8000 Transform error messages · stdlib-js/ndarray-slice-to@2239201 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2239201

Browse files
committed
Transform error messages
1 parent d504040 commit 2239201

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

lib/main.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ var isUndefined = require( '@stdlib/assert-is-undefined' );
3030
var hasOwnProp = require( '@stdlib/assert-has-own-property' );
3131
var getShape = require( '@stdlib/ndarray-shape' );
3232
var base = require( '@stdlib/ndarray-base-slice-to' );
33-
var format = require( '@stdlib/string-format' );
33+
var format = require( '@stdlib/error-tools-fmtprodmsg' );
3434

3535

3636
// FUNCTIONS //
@@ -118,26 +118,26 @@ function sliceTo( x, stop ) {
118118
};
119119
nargs = arguments.length;
120120
if ( !isndarrayLike( x ) ) {
121-
throw new TypeError( format( 'invalid argument. First argument must be an ndarray. Value: `%s`.', x ) );
121+
throw new TypeError( format( '1mj4f', x ) );
122122
}
123123
if ( isPlainObject( arguments[ nargs-1 ] ) ) {
124124
nargs -= 1;
125125
options = arguments[ nargs ];
126126
if ( hasOwnProp( options, 'strict' ) ) {
127127
if ( !isBoolean( options.strict ) ) {
128-
throw new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'strict', options.strict ) );
128+
throw new TypeError( format( '1mj2o', 'strict', options.strict ) );
129129
}
130130
opts.strict = options.strict;
131131
}
132132
sh = getShape( x );
133133
if ( nargs === 1 && sh.length > 0 ) {
134-
throw new RangeError( format( 'invalid argument. Number of indices does not match the number of array dimensions. Array shape: (%s). Number of indices: %u.', sh.join( ',' ), 0 ) );
134+
throw new RangeError( format( '1mjFE', sh.join( ',' ), 0 ) );
135135
}
136136
}
137137
if ( isArrayLikeObject( stop ) ) {
138138
args = stop;
139139
if ( nargs > 2 ) {
140-
throw new Error( 'invalid invocation. Too many arguments.' );
140+
throw new Error( format('1mj0m') );
141141
}
142142
} else {
143143
args = [];
@@ -147,7 +147,7 @@ function sliceTo( x, stop ) {
147147
}
148148
for ( i = 0; i < args.length; i++ ) {
149149
if ( isInvalidIndex( args[ i ] ) ) {
150-
throw new TypeError( format( 'invalid argument. Each index argument must be either an integer, null, or undefined. Value: `%s`.', String( args[ i ] ) ) );
150+
throw new TypeError( format( '1mjFF', String( args[ i ] ) ) );
151151
}
152152
}
153153
return base( x, args, opts.strict, false );

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"@stdlib/assert-is-undefined": "^0.2.2",
4848
"@stdlib/ndarray-base-slice-to": "^0.2.2",
4949
"@stdlib/ndarray-shape": "^0.2.2",
50-
"@stdlib/string-format": "^0.2.2",
50+
"@stdlib/error-tools-fmtprodmsg": "^0.2.2",
5151
"@stdlib/types": "^0.4.1",
5252
"@stdlib/error-tools-fmtprodmsg": "^0.2.2"
5353
},

0 commit comments

Comments
 (0)
0