Skip to content

Commit a5bd5cd

Browse files
committed
Transform error messages
1 parent 50d0100 commit a5bd5cd

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
@@ -22,7 +22,7 @@
2222

2323
var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive;
2424
var isCollection = require( '@stdlib/assert-is-collection' );
25-
var format = require( '@stdlib/string-format' );
25+
var format = require( '@stdlib/error-tools-fmtprodmsg' );
2626
var UNICODE_MAX = require( '@stdlib/constants-unicode-max' );
2727
var UNICODE_MAX_BMP = require( '@stdlib/constants-unicode-max-bmp' );
2828

@@ -84,16 +84,16 @@ function fromCodePoint( args ) {
8484
}
8585
}
8686
if ( len === 0 ) {
87-
throw new Error( 'insufficient arguments. Must provide either an array of code points or one or more code points as separate arguments.' );
87+
throw new Error( format('1Oh1V') );
8888
}
8989
str = '';
9090
for ( i = 0; i < len; i++ ) {
9191
pt = arr[ i ];
9292
if ( !isNonNegativeInteger( pt ) ) {
93-
throw new TypeError( format( 'invalid argument. Must provide valid code points (i.e., nonnegative integers). Value: `%s`.', pt ) );
93+
throw new TypeError( format( '1OhAM', pt ) );
9494
}
9595
if ( pt > UNICODE_MAX ) {
96-
throw new RangeError( format( 'invalid argument. Must provide a valid code point (i.e., cannot exceed %u). Value: `%s`.', UNICODE_MAX, pt ) );
96+
throw new RangeError( format( '1OhE5', UNICODE_MAX, pt ) );
9797
}
9898
if ( pt <= UNICODE_MAX_BMP ) {
9999
str += fromCharCode( pt );

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"@stdlib/process-read-stdin": "^0.2.2",
5050
"@stdlib/regexp-eol": "^0.2.2",
5151
"@stdlib/streams-node-stdin": "^0.2.2",
52-
"@stdlib/string-format": "^0.2.2",
52+
"@stdlib/error-tools-fmtprodmsg": "^0.2.2",
5353
"@stdlib/types": "^0.4.1",
5454
"@stdlib/utils-regexp-from-string": "^0.2.2",
5555
"@stdlib/error-tools-fmtprodmsg": "^0.2.2"

0 commit comments

Comments
 (0)