Skip to content

Commit 087b2bf

Browse files
committed
Transform error messages
1 parent 2f442c1 commit 087b2bf

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 //
@@ -88,23 +88,23 @@ function nditerMatrices( x ) {
8888
var i;
8989

9090
if ( !isndarrayLike( x ) ) {
91-
throw new TypeError( format( 'invalid argument. First argument must be an ndarray. Value: `%s`.', x ) );
91+
throw new TypeError( format( '1lN4f', x ) );
9292
}
9393
opts = {
9494
'writable': false
9595
};
9696
if ( arguments.length > 1 ) {
9797
options = arguments[ 1 ];
9898
if ( !isPlainObject( options ) ) {
99-
throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
99+
throw new TypeError( format( '1lN2V', options ) );
100100
}
101101
if ( hasOwnProp( options, 'readonly' ) ) {
102102
if ( !isBoolean( options.readonly ) ) {
103-
throw new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'readonly', options.readonly ) );
103+
throw new TypeError( format( '1lN2o', 'readonly', options.readonly ) );
104104
}
105105
opts.writable = !options.readonly;
106106
if ( opts.writable && isReadOnly( x ) ) {
107-
throw new Error( format( 'invalid option. Cannot write to read-only array.' ) );
107+
throw new Error( format( '1lNF4' ) );
108108
}
109109
}
110110
}
@@ -114,7 +114,7 @@ function nditerMatrices( x ) {
114114

115115
// Ensure that the input array has sufficient dimensions...
116116
if ( ndims < 3 ) {
117-
throw new TypeError( 'invalid argument. First argument must be an ndarray having at least three dimensions.' );
117+
throw new TypeError( format('1lNFA') );
118118
}
119119
// Check whether the input array is empty...
120120
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)