Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ff4f9f3

Browse filesBrowse files
committed
Transform error messages
1 parent 50fcd66 commit ff4f9f3
Copy full SHA for ff4f9f3

File tree

3 files changed

+7
-7
lines changed
Filter options

3 files changed

+7
-7
lines changed

‎lib/main.js

Copy file name to clipboardExpand all lines: lib/main.js
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// MODULES //
2222

2323
var isString = require( '@stdlib/assert-is-string' ).isPrimitive;
24-
var format = require( '@stdlib/string-format' );
24+
var format = require( '@stdlib/error-tools-fmtprodmsg' );
2525
var Buffer = require( '@stdlib/buffer-ctor' );
2626

2727

@@ -43,11 +43,11 @@ var Buffer = require( '@stdlib/buffer-ctor' );
4343
*/
4444
function fromString( str, encoding ) {
4545
if ( !isString( str ) ) {
46-
throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );
46+
throw new TypeError( format( '0GP3F', str ) );
4747
}
4848
if ( arguments.length > 1 ) {
4949
if ( !isString( encoding ) ) {
50-
throw new TypeError( format( 'invalid argument. Second argument must be a string. Value: `%s`.', encoding ) );
50+
throw new TypeError( format( '0GP39', encoding ) );
5151
}
5252
return Buffer.from( str, encoding );
5353
}

‎lib/polyfill.js

Copy file name to clipboardExpand all lines: lib/polyfill.js
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// MODULES //
2222

2323
var isString = require( '@stdlib/assert-is-string' ).isPrimitive;
24-
var format = require( '@stdlib/string-format' );
24+
var format = require( '@stdlib/error-tools-fmtprodmsg' );
2525
var Buffer = require( '@stdlib/buffer-ctor' );
2626

2727

@@ -43,11 +43,11 @@ var Buffer = require( '@stdlib/buffer-ctor' );
4343
*/
4444
function fromString( str, encoding ) {
4545
if ( !isString( str ) ) {
46-
throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );
46+
throw new TypeError( format( '0GP3F', str ) );
4747
}
4848
if ( arguments.length > 1 ) {
4949
if ( !isString( encoding ) ) {
50-
throw new TypeError( format( 'invalid argument. Second argument must be a string. Value: `%s`.', encoding ) );
50+
throw new TypeError( format( '0GP39', encoding ) );
5151
}
5252
return new Buffer( str, encoding ); // eslint-disable-line no-buffer-constructor
5353
}

‎package.json

Copy file name to clipboardExpand all lines: package.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"@stdlib/assert-is-function": "^0.2.2",
4141
"@stdlib/assert-is-string": "^0.2.2",
4242
"@stdlib/buffer-ctor": "^0.2.2",
43-
"@stdlib/string-format": "^0.2.2",
43+
"@stdlib/error-tools-fmtprodmsg": "^0.2.2",
4444
"@stdlib/error-tools-fmtprodmsg": "^0.2.2"
4545
},
4646
"devDependencies": {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.