Skip to content

Commit 8cc53c6

Browse files
committed
Format error messages
1 parent b700156 commit 8cc53c6

File tree

25 files changed

+50
-26
lines changed

25 files changed

+50
-26
lines changed

lib/node_modules/@stdlib/plot/base/ctor/lib/props/description/set.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
var logger = require( 'debug' );
2424
var isString = require( '@stdlib/assert/is-string' ).isPrimitive;
25+
var format = require( '@stdlib/string/format' );
2526

2627

2728
// VARIABLES //
@@ -41,7 +42,7 @@ var debug = logger( 'plot:base:set:description' );
4142
function set( str ) {
4243
/* eslint-disable no-invalid-this */
4344
if ( !isString( str ) ) {
44-
throw new TypeError( 'invalid value. `description` must be a string. Value: `' + str + '.`' );
45+
throw new TypeError( format( 'invalid value. `%s` must be a string. Value: `%s`.', 'description', str ) );
4546
}
4647
if ( str !== this._description ) {
4748
debug( 'Current value: %s.', this._description );

lib/node_modules/@stdlib/plot/base/ctor/lib/props/title/set.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
var logger = require( 'debug' );
2424
var isString = require( '@stdlib/assert/is-string' ).isPrimitive;
25+
var format = require( '@stdlib/string/format' );
2526

2627

2728
// VARIABLES //
@@ -41,7 +42,7 @@ var debug = logger( 'plot:base:set:title' );
4142
function set( str ) {
4243
/* eslint-disable no-invalid-this */
4344
if ( !isString( str ) ) {
44-
throw new TypeError( 'invalid value. `title` must be a string. Value: `' + str + '.`' );
45+
throw new TypeError( format( 'invalid value. `%s` must be a string. Value: `%s`.', 'title', str ) );
4546
}
4647
if ( str !== this._title ) {
4748
debug( 'Current value: %s.', this._title );

lib/node_modules/@stdlib/plot/base/ctor/lib/props/x-label/set.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
var logger = require( 'debug' );
2424
var isString = require( '@stdlib/assert/is-string' ).isPrimitive;
25+
var format = require( '@stdlib/string/format' );
2526

2627

2728
// VARIABLES //
@@ -41,7 +42,7 @@ var debug = logger( 'plot:base:set:x-label' );
4142
function set( label ) {
4243
/* eslint-disable no-invalid-this */
4344
if ( !isString( label ) ) {
44-
throw new TypeError( 'invalid value. `xLabel` must be a string. Value: `' + label + '.`' );
45+
throw new TypeError( format( 'invalid value. `%s` must be a string. Value: `%s`.', 'xLabel', label ) );
4546
}
4647
if ( label !== this._xLabel ) {
4748
debug( 'Current value: %s.', this._xLabel );

lib/node_modules/@stdlib/plot/base/ctor/lib/props/y-label/set.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
var logger = require( 'debug' );
2424
var isString = require( '@stdlib/assert/is-string' ).isPrimitive;
25+
var format = require( '@stdlib/string/format' );
2526

2627

2728
// VARIABLES //
@@ -41,7 +42,7 @@ var debug = logger( 'plot:base:set:y-label' );
4142
function set( label ) {
4243
/* eslint-disable no-invalid-this */
4344
if ( !isString( label ) ) {
44-
throw new TypeError( 'invalid value. `yLabel` must be a string. Value: `' + label + '.`' );
45+
throw new TypeError( format( 'invalid value. `%s` must be a string. Value: `%s`.', 'yLabel', label ) );
4546
}
4647
if ( label !== this._yLabel ) {
4748
debug( 'Current value: %s.', this._yLabel );

lib/node_modules/@stdlib/plot/components/svg/axis/lib/validators/label.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
// MODULES //
2222

2323
var isString = require( '@stdlib/assert/is-string' ).isPrimitive;
24+
var format = require( '@stdlib/string/format' );
2425

2526

2627
// MAIN //
@@ -34,7 +35,7 @@ var isString = require( '@stdlib/assert/is-string' ).isPrimitive;
3435
*/
3536
function test( v ) {
3637
if ( !isString( v ) ) {
37-
return new TypeError( 'invalid value. `label` must be a string. Value: `' + v + '.`' );
38+
return new TypeError( format( 'invalid value. `%s` must be a string. Value: `%s`.', 'label', v ) );
3839
}
3940
return null;
4041
}

lib/node_modules/@stdlib/plot/components/svg/axis/lib/validators/scale.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
// MODULES //
2222

2323
var isFunction = require( '@stdlib/assert/is-function' );
24+
var format = require( '@stdlib/string/format' );
2425

2526

2627
// MAIN //
@@ -34,7 +35,7 @@ var isFunction = require( '@stdlib/assert/is-function' );
3435
*/
3536
function test( v ) {
3637
if ( !isFunction( v ) ) {
37-
return new TypeError( 'invalid value. `scale` must be a function. Value: `' + v + '.`' );
38+
return new TypeError( format( 'invalid value. `%s` must be a function. Value: `%s`.', 'scale', v ) );
3839
}
3940
return null;
4041
}

lib/node_modules/@stdlib/plot/components/svg/clip-path/lib/validators/id.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
// MODULES //
2222

2323
var isString = require( '@stdlib/assert/is-string' ).isPrimitive;
24+
var format = require( '@stdlib/string/format' );
2425

2526

2627
// MAIN //
@@ -34,7 +35,7 @@ var isString = require( '@stdlib/assert/is-string' ).isPrimitive;
3435
*/
3536
function test( v ) {
3637
if ( !isString( v ) ) {
37-
return new TypeError( 'invalid value. `id` must be a string. Value: `' + v + '.`' );
38+
return new TypeError( format( 'invalid value. `%s` must be a string. Value: `%s`.', 'id', v ) );
3839
}
3940
return null;
4041
}

lib/node_modules/@stdlib/plot/components/svg/marks/lib/validators/clip_path_id.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
// MODULES //
2222

2323
var isString = require( '@stdlib/assert/is-string' ).isPrimitive;
24+
var format = require( '@stdlib/string/format' );
2425

2526

2627
// MAIN //
@@ -34,7 +35,7 @@ var isString = require( '@stdlib/assert/is-string' ).isPrimitive;
3435
*/
3536
function test( v ) {
3637
if ( !isString( v ) ) {
37-
return new TypeError( 'invalid value. `clipPathId` must be a string. Value: `' + v + '.`' );
38+
return new TypeError( format( 'invalid value. `%s` must be a string. Value: `%s`.', 'clipPathId', v ) );
3839
}
3940
return null;
4041
}

lib/node_modules/@stdlib/plot/components/svg/path/lib/props/color/set.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
var logger = require( 'debug' );
2424
var isString = require( '@stdlib/assert/is-string' ).isPrimitive;
25+
var format = require( '@stdlib/string/format' );
2526

2627

2728
// VARIABLES //
@@ -41,7 +42,7 @@ var debug = logger( 'path:set:color' );
4142
function set( color ) {
4243
/* eslint-disable no-invalid-this */
4344
if ( !isString( color ) ) {
44-
throw new TypeError( 'invalid value. `color` must be a string. Value: `' + color + '.`' );
45+
throw new TypeError( format( 'invalid value. `%s` must be a string. Value: `%s`.', 'color', color ) );
4546
}
4647
debug( 'Current value: %d.', this._color );
4748

lib/node_modules/@stdlib/plot/components/svg/path/lib/props/label/set.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
var logger = require( 'debug' );
2424
var isString = require( '@stdlib/assert/is-string' ).isPrimitive;
25+
var format = require( '@stdlib/string/format' );
2526

2627

2728
// VARIABLES //
@@ -41,7 +42,7 @@ var debug = logger( 'path:set:label' );
4142
function set( label ) {
4243
/* eslint-disable no-invalid-this */
4344
if ( !isString( label ) ) {
44-
throw new TypeError( 'invalid value. `label` must be a string. Value: `' + label + '.`' );
45+
throw new TypeError( format( 'invalid value. `%s` must be a string. Value: `%s`.', 'label', label ) );
4546
}
4647
debug( 'Current value: %d.', this._label );
4748

0 commit comments

Comments
 (0)