From 55af81785bf71ae23a27eb66a59b3e3f053cc848 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 19 Apr 2022 01:05:21 +0000 Subject: [PATCH] Transform error messages --- lib/context.js | 4 ++-- lib/functions/pkg2alias.js | 4 ++-- lib/repl.js | 4 ++-- lib/validate.js | 4 ++-- package.json | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/context.js b/lib/context.js index 7255b42..d28d9ec 100644 --- a/lib/context.js +++ b/lib/context.js @@ -23,7 +23,7 @@ var objectKeys = require( '@stdlib/utils-keys' ); var setReadOnly = require( '@stdlib/utils-define-read-only-property' ); var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); var deepGet = require( '@stdlib/utils-deep-get' ); var help = require( './functions/help.js' ); var example = require( './functions/example.js' ); @@ -80,7 +80,7 @@ function extend( repl ) { // Attempt to add the value to the tree (checking for collisions): if ( hasOwnProp( o, k ) ) { - throw new Error( format( 'invalid operation. Alias already exists in REPL context. Alias: `%s`. Value: `%s`.', key, deepGet( tmp, key ) ) ); + throw new Error( format( '0RO8a', key, deepGet( tmp, key ) ) ); } else { o[ k ] = NAMESPACE[ i ].value; } diff --git a/lib/functions/pkg2alias.js b/lib/functions/pkg2alias.js index b6da0ed..246362b 100644 --- a/lib/functions/pkg2alias.js +++ b/lib/functions/pkg2alias.js @@ -21,7 +21,7 @@ // MODULES // var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); var NAMESPACE = require( './../namespace.js' ); var logger = require( './../console.js' ); @@ -44,7 +44,7 @@ var NO_ALIAS_TEXT = 'Unrecognized package name.'; function pkg2alias( pkg ) { var i; if ( !isString( pkg ) ) { - throw new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', pkg ) ); + throw new TypeError( format( '0RO3N', pkg ) ); } for ( i = 0; i < NAMESPACE.length; i++ ) { if ( pkg === NAMESPACE[ i ].path ) { diff --git a/lib/repl.js b/lib/repl.js index 08d9e4a..27c9ab8 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -22,7 +22,7 @@ var r = require( 'repl' ); var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); var validate = require( './validate.js' ); var defaults = require( './defaults.js' ); var extendContext = require( './context.js' ); @@ -66,7 +66,7 @@ function repl( options, clbk ) { cb = clbk; } if ( !isFunction( cb ) ) { - throw new TypeError( format( 'invalid argument. Callback argument must be a function. Value: `%s`.', cb ) ); + throw new TypeError( format( '0RO2n', cb ) ); } // Start the REPL server: server = r.start( opts ); diff --git a/lib/validate.js b/lib/validate.js index ef71f75..c3d72b9 100644 --- a/lib/validate.js +++ b/lib/validate.js @@ -21,7 +21,7 @@ // MODULES // var isObject = require( '@stdlib/assert-is-plain-object' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // MAIN // @@ -44,7 +44,7 @@ var format = require( '@stdlib/string-format' ); */ function validate( opts, options ) { if ( !isObject( options ) ) { - return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); + return new TypeError( format( '0RO2h', options ) ); } return null; } diff --git a/package.json b/package.json index d7f2a5d..417b834 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "@stdlib/repl-help": "^0.0.x", "@stdlib/streams-node-stdin": "^0.0.x", "@stdlib/streams-node-stdout": "^0.0.x", - "@stdlib/string-format": "^0.0.x", + "@stdlib/error-tools-fmtprodmsg": "^0.0.x", "@stdlib/utils-deep-get": "^0.0.x", "@stdlib/utils-define-read-only-property": "^0.0.x", "@stdlib/utils-keys": "^0.0.x"