8000 Transform error messages · stdlib-js/ndarray-empty@b93e8fe · GitHub
[go: up one dir, main page]

Skip to content

Commit b93e8fe

Browse files
committed
Transform error messages
1 parent b74d9f4 commit b93e8fe

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/main.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ var allocUnsafe = require( '@stdlib/buffer-alloc-unsafe' );
3030
var numel = require( '@stdlib/ndarray-base-numel' );
3131
var ndarray = require( '@stdlib/ndarray-ctor' );
3232
var defaults = require( '@stdlib/ndarray-defaults' );
33-
var format = require( '@stdlib/string-format' );
33+
var format = require( '@stdlib/error-tools-fmtprodmsg' );
3434

3535

3636
// VARIABLES //
@@ -82,7 +82,7 @@ function empty( shape ) {
8282
if ( arguments.length > 1 ) {
8383
options = arguments[ 1 ];
8484
if ( !isPlainObject( options ) ) {
85-
throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
85+
throw new TypeError( format( '1db2V,FD', options ) );
8686
}
8787
if ( hasOwnProp( options, 'dtype' ) ) {
8888
dtype = options.dtype;
@@ -109,14 +109,14 @@ function empty( shape ) {
109109
} else if ( isArrayLike( shape ) ) {
110110
sh = shape;
111111
} else {
112-
throw new TypeError( format( 'invalid argument. First argument must be either a nonnegative integer or an array of nonnegative integers. Value: `%s`.', shape ) );
112+
throw new TypeError( format( '1db5s,Kf', shape ) );
113113
}
114114
ndims = sh.length;
115115
if ( ndims > 0 ) {
116116
len = numel( sh );
117117
if ( len !== len || len < 0 ) {
118118
// We should only get here if we've been provided an invalid shape (e.g., an array containing negative integers, etc)...
119-
throw new TypeError( format( 'invalid argument. First argument must be either a nonnegative integer or an array of nonnegative integers. Value: `%s`.', shape ) );
119+
throw new TypeError( format( '1db5s,Kf', shape ) );
120120
}
121121
st = shape2strides( sh, order );
122122
} else {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"@stdlib/ndarray-base-strides2offset": "^0.1.1",
4848
"@stdlib/ndarray-ctor": "^0.1.0",
4949
"@stdlib/ndarray-defaults": "^0.1.1",
50-
"@stdlib/string-format": "^0.1.1",
50+
"@stdlib/error-tools-fmtprodmsg": "^0.1.1",
5151
"@stdlib/types": "^0.2.0"
5252
},
5353
"devDependencies": {

0 commit comments

Comments
 (0)
0