Skip to content

Commit 5840a0d

Browse files
committed
Transform error messages
1 parent 1b02fdc commit 5840a0d

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

3838

3939
// MAIN //
@@ -91,7 +91,7 @@ function filter( x, options, predicate, thisArg ) {
9191
var v;
9292
var i;
9393
if ( !isndarrayLike( x ) ) {
94-
throw new TypeError( format( 'invalid argument. First argument must be an ndarray-like object. Value: `%s`.', x ) );
94+
throw new TypeError( format( 'null5t', x ) );
9595
}
9696
if ( arguments.length < 3 ) {
9797
clbk = options;
@@ -111,11 +111,11 @@ function filter( x, options, predicate, thisArg ) {
111111
ctx = thisArg;
112112
}
113113
if ( !isFunction( clbk ) ) {
114-
throw new TypeError( format( 'invalid argument. Callback argument must be a function. Value: `%s`.', clbk ) );
114+
throw new TypeError( format( 'null2b', clbk ) );
115115
}
116116
if ( hasOpts ) {
117117
if ( !isPlainObject( opts ) ) {
118-
throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', opts ) );
118+
throw new TypeError( format( 'null2V', opts ) );
119119
}
120120
if ( hasOwnProp( opts, 'dtype' ) ) {
121121
dt = opts.dtype;
@@ -124,7 +124,7 @@ function filter( x, options, predicate, thisArg ) {
124124
}
125125
if ( hasOwnProp( opts, 'order' ) ) {
126126
if ( !isOrder( opts.order ) ) {
127-
throw new TypeError( format( 'invalid option. `%s` option must be a recognized order. Option: `%s`.', 'order', opts.order ) );
127+
throw new TypeError( format( 'null5C', 'order', opts.order ) );
128128
}
129129
ord = opts.order;
130130
}
@@ -135,7 +135,7 @@ function filter( x, options, predicate, thisArg ) {
135135
ctor = ctors( dt );
136136
if ( ctor === null ) {
137137
// The only way we should get here is if the user provided an unsupported data type, as `getDType` should error if the input array has an unrecognized/unsupported data type...
138-
throw new TypeError( format( 'invalid option. `%s` option must be a recognized data type. Option: `%s`.', 'dtype', opts.dtype ) );
138+
throw new TypeError( format( 'nullBf', 'dtype', opts.dtype ) );
139139
}
140140
// Resolve the iteration order:
141141
if ( ord === void 0 ) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"@stdlib/ndarray-dtype": "^0.2.2",
5151
"@stdlib/ndarray-order": "^0.2.2",
5252
"@stdlib/ndarray-shape": "^0.2.2",
53-
"@stdlib/string-format": "^0.2.2",
53+
"@stdlib/error-tools-fmtprodmsg": "^0.2.2",
5454
"@stdlib/types": "^0.4.3",
5555
"@stdlib/error-tools-fmtprodmsg": "^0.2.2"
5656
},

0 commit comments

Comments
 (0)