Skip to content

Commit b7542db

Browse files
committed
Transform error messages
1 parent 97a20d0 commit b7542db

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

lib/factory.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' );
3434
var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' );
3535
var accessors = require( '@stdlib/array-base-accessors' );
3636
var adtype = require( '@stdlib/array-dtype' );
37-
var format = require( '@stdlib/string-format' );
37+
var format = require( '@stdlib/error-tools-fmtprodmsg' );
3838
var ArrayBuffer = require( '@stdlib/array-buffer' );
3939
var ceil = require( '@stdlib/math-base-special-ceil' );
4040
var floor = require( '@stdlib/math-base-special-floor' );
@@ -226,7 +226,7 @@ function factory( options ) {
226226
}
227227
ctor = ctors( dtype );
228228
if ( ctor === null ) {
229-
throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );
229+
throw new TypeError( format( '01H2Y,KZ', dtype ) );
230230
}
231231
if ( nargs <= 0 ) {
232232
return new ctor( 0 );
@@ -263,7 +263,7 @@ function factory( options ) {
263263
}
264264
return out;
265265
}
266-
throw new TypeError( format( 'invalid argument. First argument must be either an array length or an array-like object. Value: `%s`.', arguments[ 0 ] ) );
266+
throw new TypeError( format( '01H2r,N0', arguments[ 0 ] ) );
267267
}
268268

269269
/**
@@ -329,7 +329,7 @@ function factory( options ) {
329329
if ( isTypedArrayLike( buf ) && buf.buffer ) {
330330
buf = buf.buffer;
331331
} else if ( !isArrayBuffer( buf ) ) {
332-
throw new TypeError( format( 'invalid argument. Must provide a typed array or ArrayBuffer. Value: `%s`.', buf ) );
332+
throw new TypeError( format( '01H2s,N1', buf ) );
333333
}
334334
if ( buf.byteLength > 0 ) {
335335
n = floor( log2( buf.byteLength ) );

lib/validate.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
var isObject = require( '@stdlib/assert-is-plain-object' );
2424
var hasOwnProp = require( '@stdlib/assert-has-own-property' );
2525
var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive;
26-
var format = require( '@stdlib/string-format' );
26+
var format = require( '@stdlib/error-tools-fmtprodmsg' );
2727

2828

2929
// MAIN //
@@ -49,12 +49,12 @@ var format = require( '@stdlib/string-format' );
4949
*/
5050
function validate( opts, options ) {
5151
if ( !isObject( options ) ) {
52-
return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
52+
return new TypeError( format( '01H2V,FD', options ) );
5353
}
5454
if ( hasOwnProp( options, 'highWaterMark' ) ) {
5555
opts.highWaterMark = options.highWaterMark;
5656
if ( !isNonNegativeInteger( opts.highWaterMark ) ) {
57-
return new TypeError( format( 'invalid option. `%s` option must be a nonnegative integer. Option: `%s`.', 'highWaterMark', opts.highWaterMark ) );
57+
return new TypeError( format( '01H2t,G9', 'highWaterMark', opts.highWaterMark ) );
5858
}
5959
}
6060
return null;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"@stdlib/math-base-special-min": "^0.1.0",
5858
"@stdlib/strided-base-reinterpret-complex128": "^0.1.0",
5959
"@stdlib/strided-base-reinterpret-complex64": "^0.1.0",
60-
"@stdlib/string-format": "^0.1.0",
60+
"@stdlib/error-tools-fmtprodmsg": "^0.1.0",
6161
"@stdlib/types": "^0.1.0",
6262
"@stdlib/utils-define-nonenumerable-read-only-accessor": "^0.1.0",
6363
"@stdlib/utils-define-nonenumerable-read-only-property": "^0.1.0"

0 commit comments

Comments
 (0)