8000 Transform error messages · stdlib-js/ndarray-iter-subarrays@98b231d · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit 98b231d

Browse files
committed
Transform error messages
1 parent 6b65f24 commit 98b231d

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
@@ -34,7 +34,7 @@ var numel = require( '@stdlib/ndarray-base-numel' );
3434
var slice = require( '@stdlib/ndarray-base-slice' );
3535
var nextCartesianIndex = require( '@stdlib/ndarray-base-next-cartesian-index' ).assign;
3636
var args2multislice = require( '@stdlib/slice-base-args2multislice' );
37-
var format = require( '@stdlib/string-format' );
37+
var format = require( '@stdlib/error-tools-fmtprodmsg' );
3838

3939

4040
// MAIN //
@@ -91,26 +91,26 @@ function nditerSubarrays( x, ndims ) {
9191
var i;
9292

9393
if ( !isndarrayLike( x ) ) {
94-
throw new TypeError( format( 'invalid argument. First argument must be an ndarray. Value: `%s`.', x ) );
94+
throw new TypeError( format( 'null4f', x ) );
9595
}
9696
if ( !isPositiveInteger( ndims ) ) {
97-
throw new TypeError( format( 'invalid argument. Second argument must be a positive integer. Value: `%s`.', ndims ) );
97+
throw new TypeError( format( 'null45', ndims ) );
9898
}
9999
opts = {
100100
'writable': false
101101
};
102102
if ( arguments.length > 2 ) {
103103
options = arguments[ 2 ];
104104
if ( !isPlainObject( options ) ) {
105-
throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
105+
throw new TypeError( format( 'null2V', options ) );
106106
}
107107
if ( hasOwnProp( options, 'readonly' ) ) {
108108
if ( !isBoolean( options.readonly ) ) {
109-
throw new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'readonly', options.readonly ) );
109+
throw new TypeError( format( 'null2o', 'readonly', options.readonly ) );
110110
}
111111
opts.writable = !options.readonly;
112112
if ( opts.writable && isReadOnly( x ) ) {
113-
throw new Error( format( 'invalid option. Cannot write to read-only array.' ) );
113+
throw new Error( format( 'nullF4' ) );
114114
}
115115
}
116116
}

package.json

Lines changed: 1 addition & 1 deletion
75B0
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"@stdlib/ndarray-base-slice": "^0.2.2",
5050
"@stdlib/ndarray-shape": "^0.2.2",
5151
"@stdlib/slice-base-args2multislice": "^0.2.2",
52-
"@stdlib/string-format": "^0.2.2",
52+
"@stdlib/error-tools-fmtprodmsg": "^0.2.2",
5353
"@stdlib/symbol-iterator": "^0.2.2",
5454
"@stdlib/types": "^0.4.1",
5555
"@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2",

0 commit comments

Comments
 (0)
0