@@ -30,7 +30,7 @@ var MultiSlice = require( '@stdlib/slice-multi' );
3030var args2multislice = require ( '@stdlib/slice-base-args2multislice' ) ;
3131var base = require ( '@stdlib/ndarray-base-slice' ) ;
3232var getShape = require ( '@stdlib/ndarray-shape' ) ;
33- var format = require ( '@stdlib/string-format ' ) ;
33+ var format = require ( '@stdlib/error-tools-fmtprodmsg ' ) ;
3434
3535
3636// MAIN //
@@ -98,32 +98,32 @@ function slice( x, s ) {
9898 } ;
9999 nargs = arguments . length ;
100100 if ( ! isndarrayLike ( x ) ) {
101- throw new TypeError ( format ( 'invalid argument. First argument must be an ndarray. Value: `%s`. ' , x ) ) ;
101+ throw new TypeError ( format ( '1jV4f ' , x ) ) ;
102102 }
103103 if ( isPlainObject ( arguments [ nargs - 1 ] ) ) {
104104 nargs -= 1 ;
105105 options = arguments [ nargs ] ;
106106 if ( hasOwnProp ( options , 'strict' ) ) {
107107 if ( ! isBoolean ( options . strict ) ) {
108- throw new TypeError ( format ( 'invalid option. `%s` option must be a boolean. Option: `%s`. ' , 'strict' , options . strict ) ) ;
108+ throw new TypeError ( format ( '1jV2o ' , 'strict' , options . strict ) ) ;
109109 }
110110 opts . strict = options . strict ;
111111 }
112112 sh = getShape ( x ) ;
113113 if ( nargs === 1 && sh . length > 0 ) {
114- throw new RangeError ( format ( 'invalid argument. Number of slice dimensions does not match the number of array dimensions. Array shape: (%s). Slice dimensions: %u. ' , sh . join ( ',' ) , 0 ) ) ;
114+ throw new RangeError ( format ( '1jVEt ' , sh . join ( ',' ) , 0 ) ) ;
115115 }
116116 }
117117 if ( isMultiSlice ( s ) ) {
118118 S = s ;
119119 if ( nargs > 2 ) {
120- throw new Error ( 'invalid invocation. Too many arguments.' ) ;
120+ throw new Error ( format ( '1jV0m' ) ) ;
121121 }
122122 } else {
123123 if ( isArrayLikeObject ( s ) ) {
124124 args = s ;
125125 if ( nargs > 2 ) {
126- throw new Error ( 'invalid invocation. Too many arguments.' ) ;
126+ throw new Error ( format ( '1jV0m' ) ) ;
127127 }
128128 } else {
129129 args = [ ] ;
@@ -139,7 +139,7 @@ function slice( x, s ) {
139139 try {
140140 new MultiSlice ( args [ i ] ) ; // eslint-disable-line no-new
141141 } catch ( err ) { // eslint-disable-line no-unused-vars
142- throw new TypeError ( format ( 'invalid argument. Slice arguments must be either a Slice, integer, null, or undefined. Value: `%s`. ' , String ( args [ i ] ) ) ) ;
142+ throw new TypeError ( format ( '1jVEu ' , String ( args [ i ] ) ) ) ;
143143 }
144144 }
145145 }
0 commit comments