Skip to content

Commit 01e38d7

Browse files
committed
Transform error messages
1 parent 8397209 commit 01e38d7

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

3838

3939
// MAIN //
@@ -94,23 +94,23 @@ function nditerRows( x ) {
9494
var i;
9595

9696
if ( !isndarrayLike( x ) ) {
97-
throw new TypeError( format( 'invalid argument. First argument must be an ndarray. Value: `%s`.', x ) );
97+
throw new TypeError( format( '1jx4f', x ) );
9898
}
9999
opts = {
100100
'writable': false
101101
};
102102
if ( arguments.length > 1 ) {
103103
options = arguments[ 1 ];
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( '1jx2V', 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( '1jx2o', '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( '1jxF4' ) );
114114
}
115115
}
116116
}
@@ -120,7 +120,7 @@ function nditerRows( x ) {
120120

121121
// Ensure that the input array has sufficient dimensions...
122122
if ( ndims < 2 ) {
123-
throw new TypeError( 'invalid argument. First argument must be an ndarray having at least two dimensions.' );
123+
throw new TypeError( format('1jxF2') );
124124
}
125125
// Check whether the input array is empty...
126126
N = numel( shape );

package.json

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

0 commit comments

Comments
 (0)