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

+2-1
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

+2-1
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

+2-1
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

+2-1
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

+2-1
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

+2-1
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

+2-1
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

+2-1
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

+2-1
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

+2-1
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

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

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

2627

2728
// VARIABLES //
@@ -42,7 +43,7 @@ var debug = logger( 'path:set:opacity' );
4243
function set( opacity ) {
4344
/* eslint-disable no-invalid-this */
4445
if ( !isNumber( opacity ) ) {
45-
throw new TypeError( 'invalid value. `opacity` must be a number. Value: `' + opacity + '.`' );
46+
throw new TypeError( format( 'invalid value. `%s` must be a number. Value: `%s`.', 'opacity', opacity ) );
4647
}
4748
if (
4849
opacity < 0.0 ||

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

+2-1
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:style' );
4142
function set( v ) {
4243
/* eslint-disable no-invalid-this */
4344
if ( !isString( v ) ) {
44-
throw new TypeError( 'invalid value. `style` must be a string. Value: `' + v + '.`' );
45+
throw new TypeError( format( 'invalid value. `%s` must be a string. Value: `%s`.', 'style', v ) );
4546
}
4647
debug( 'Current value: %d.', this._style );
4748

lib/node_modules/@stdlib/plot/components/svg/title/lib/validators/text.js

+2-1
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. `text` must be a string. Value: `' + v + '.`' );
38+
return new TypeError( format( 'invalid value. `%s` must be a string. Value: `%s`.', 'text', v ) );
3839
}
3940
return null;
4041
}

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

+2-1
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: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/ctor/lib/props/title/set.js

+2-1
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: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/ctor/lib/props/x-label/set.js

+2-1
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: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/ctor/lib/props/x-scale/set.js

+2-1
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 //
@@ -42,7 +43,7 @@ var debug = logger( 'plot:set:x-scale' );
4243
function set( scale ) {
4344
/* eslint-disable no-invalid-this */
4445
if ( !isString( scale ) ) {
45-
throw new TypeError( 'invalid value. `xScale` must be a string. Value: `' + scale + '.`' );
46+
throw new TypeError( format( 'invalid value. `%s` must be a string. Value: `%s`.', 'xScale', scale ) );
4647
}
4748
// TODO: test for valid scale
4849

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

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

2627

2728
// VARIABLES //
@@ -42,7 +43,7 @@ var debug = logger( 'plot:set:x' );
4243
function set( x ) {
4344
/* eslint-disable no-invalid-this */
4445
if ( !isArray( x ) ) {
45-
throw new TypeError( 'invalid value. `x` must be an array. Value: `' + x + '.`' );
46+
throw new TypeError( format( 'invalid value. `%s` must be an array. Value: `%s`.', 'x', x ) );
4647
}
4748
debug( 'Current value: %s.', JSON.stringify( this._xData ) );
4849

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

+2-1
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: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/ctor/lib/props/y-scale/set.js

+2-1
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 //
@@ -42,7 +43,7 @@ var debug = logger( 'plot:set:y-scale' );
4243
function set( scale ) {
4344
/* eslint-disable no-invalid-this */
4445
if ( !isString( scale ) ) {
45-
throw new TypeError( 'invalid value. `yScale` must be a string. Value: `' + scale + '.`' );
46+
throw new TypeError( format( 'invalid value. `%s` must be a string. Value: `%s`.', 'yScale', scale ) );
4647
}
4748
// TODO: test for valid scale
4849

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

+2-1
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 //
@@ -42,7 +43,7 @@ var debug = logger( 'plot:set:description' );
4243
function set( str ) {
4344
/* eslint-disable no-invalid-this */
4445
if ( !isString( str ) ) {
45-
throw new TypeError( 'invalid value. `description` must be a string. Value: `' + str + '.`' );
46+
throw new TypeError( format( 'invalid value. `%s` must be a string. Value: `%s`.', 'description', str ) );
4647
}
4748
if ( str !== this._description ) {
4849
debug( 'Current value: %s.', this._description );

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

+2-1
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 //
@@ -42,7 +43,7 @@ var debug = logger( 'sparkline:set:label' );
4243
function set( label ) {
4344
/* eslint-disable no-invalid-this */
4445
if ( !isString( label ) ) {
45-
throw new TypeError( 'invalid value. `label` must be a string. Value: `' + label + '.`' );
46+
throw new TypeError( format( 'invalid value. `%s` must be a string. Value: `%s`.', 'label', label ) );
4647
}
4748
if ( label !== this._label ) {
4849
debug( 'Current value: %s.', this._label );

lib/node_modules/@stdlib/plot/unicode/stemleaf/lib/set_xvalue.js

+2-1
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 //
@@ -35,7 +36,7 @@ var isFunction = require( '@stdlib/assert/is-function' );
3536
function setXValue( fcn ) {
3637
/* eslint-disable no-invalid-this */
3738
if ( !isFunction( fcn ) ) {
38-
throw new TypeError( 'invalid value. `xValue` must be a function. Value: `' + fcn + '`.' );
39+
throw new TypeError( format( 'invalid value. `%s` must be a function. Value: `%s`.', 'xValue', fcn ) );
3940
}
4041
this._xValue = fcn;
4142
}

0 commit comments

Comments
 (0)