10000 Transform error messages · stdlib-js/ndarray-iter-stacks@b01dfce · GitHub
[go: up one dir, main page]

Skip to content

Commit b01dfce

Browse files
committed
Transform error messages
1 parent 771d708 commit b01dfce

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
@@ -38,7 +38,7 @@ var numel = require( '@stdlib/ndarray-base-numel' );
3838
var slice = require( '@stdlib/ndarray-base-slice' );
3939
var nextCartesianIndex = require( '@stdlib/ndarray-base-next-cartesian-index' ).assign;
4040
var args2multislice = require( '@stdlib/slice-base-args2multislice' );
41-
var format = require( '@stdlib/string-format' );
41+
var format = require( '@stdlib/error-tools-fmtprodmsg' );
4242

4343

4444
// MAIN //
@@ -103,7 +103,7 @@ function nditerStacks( x, dims ) {
103103
var j;
104104

105105
if ( !isndarrayLike( x ) ) {
106-
throw new TypeError( format( 'invalid argument. First argument must be an ndarray. Value: `%s`.', x ) );
106+
throw new TypeError( format( 'null4f', x ) );
107107
}
108108
if ( !isIntegerArray( dims ) ) {
109109
throw new TypeError( format( 'invalid argument. Second argument must be an array of integers. Value: `%s`.', dims ) );
@@ -114,15 +114,15 @@ function nditerStacks( x, dims ) {
114114
if ( arguments.length > 2 ) {
115115
options = arguments[ 2 ];
116116
if ( !isPlainObject( options ) ) {
117-
throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
117+
throw new TypeError( format( 'null2V', options ) );
118118
}
119119
if ( hasOwnProp( options, 'readonly' ) ) {
120120
if ( !isBoolean( options.readonly ) ) {
121-
throw new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'readonly', options.readonly ) );
121+
throw new TypeError( format( 'null2o', 'readonly', options.readonly ) );
122122
}
123123
opts.writable = !options.readonly;
124124
if ( opts.writable && isReadOnly( x ) ) {
125-
throw new Error( format( 'invalid option. Cannot write to read-only array.' ) );
125+
throw new Error( format( 'nullF4' ) );
126126
}
127127
}
128128
}
@@ -142,7 +142,7 @@ function nditerStacks( x, dims ) {
142142
for ( i = 0; i < M; i++ ) {
143143
d = normalizeIndex( dims[ i ], ndims-1 );
144144
if ( d === -1 ) {
145-
throw new RangeError( format( 'invalid argument. Dimension index exceeds the number of dimensions. Number of dimensions: %d. Value: `%d`.', ndims, dims[ i ] ) );
145+
throw new RangeError( format( 'nullF8', ndims, dims[ i ] ) );
146146
}
147147
dims[ i ] = d;
148148
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"@stdlib/ndarray-base-slice": "^0.2.2",
5454
"@stdlib/ndarray-shape": "^0.2.2",
5555
"@stdlib/slice-base-args2multislice": "^0.2.2",
56-
"@stdlib/string-format": "^0.2.2",
56+
"@stdlib/error-tools-fmtprodmsg": "^0.2.2",
5757
"@stdlib/symbol-iterator": "^0.2.2",
5858
"@stdlib/types": "^0.4.3",
5959
"@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2",

0 commit comments

Comments
 (0)
0