Skip to content

Commit 651c006

Browse files
committed
refactor: better error messages
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 5cbf09d commit 651c006

File tree

5 files changed

+14
-4
lines changed

5 files changed

+14
-4
lines changed

lib/node_modules/@stdlib/lapack/base/dlange/lib/base.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ function maxAbs( M, N, A, strideA1, strideA2, offsetA ) {
140140
* @param {integer} strideA1 - stride of the first dimension of `A`
141141
* @param {integer} strideA2 - stride of the second dimension of `A`
142142
* @param {NonNegativeInteger} offsetA - starting index of `A`
143-
* @param {Float64Array} work - only used to compute the infinity norm, expects `M` indexed elements if computing the infinity norm otherwise it's fine to pass a dummy array
143+
* @param {Float64Array} work - work array, should have `M` indexed elements
144144
* @param {integer} strideWork - stride length of `work`
145145
* @param {NonNegativeInteger} offsetWork - starting index of `work`
146146
* @returns {number} required norm value

lib/node_modules/@stdlib/lapack/base/dlange/lib/dlange.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ var isColumnMajor = require( '@stdlib/ndarray/base/assert/is-column-major-string
2626
var max = require( '@stdlib/math/base/special/max' );
2727
var format = require( '@stdlib/string/format' );
2828
var isOperation = require( './isoperation.js' );
29+
var NORMS = require( './norms.json' ).norms;
2930
var base = require( './base.js' );
3031

3132

@@ -71,7 +72,7 @@ function dlange( order, norm, M, N, A, LDA, work ) {
7172
throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) );
7273
}
7374
if ( !isOperation( norm ) ) {
74-
throw new TypeError( format( 'invalid argument. Second argument must be a valid operation. Value: `%s`.', norm ) );
75+
throw new TypeError( format( 'invalid argument. Second argument must be one of the following: "%s". Value: `%s`.', NORMS.join( '", "' ), norm ) );
7576
}
7677
if ( isRowMajor( order ) && LDA < max( 1, N ) ) {
7778
throw new RangeError( format( 'invalid argument. Sixth argument must be greater than or equal to max(1,%d). Value: `%d`.', N, LDA ) );

lib/node_modules/@stdlib/lapack/base/dlange/lib/isoperation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ var contains = require( '@stdlib/array/base/assert/contains' ).factory;
2525

2626
// VARIABLES //
2727

28-
var NORMS = [ 'max', 'infinity', 'one', 'frobenius' ];
28+
var NORMS = require( './norms.json' ).norms;
2929

3030

3131
// MAIN //

lib/node_modules/@stdlib/lapack/base/dlange/lib/ndarray.js

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

2323
var format = require( '@stdlib/string/format' );
2424
var isOperation = require( './isoperation.js' );
25+
var NORMS = require( './norms.json' ).norms;
2526
var base = require( './base.js' );
2627

2728

@@ -61,7 +62,7 @@ var base = require( './base.js' );
6162
*/
6263
function dlange( norm, M, N, A, strideA1, strideA2, offsetA, work, strideWork, offsetWork ) { // eslint-disable-line max-len
6364
if ( !isOperation( norm ) ) {
64-
throw new TypeError( format( 'invalid argument. First argument must be a valid operation. Value: `%s`.', norm ) );
65+
throw new TypeError( format( 'invalid argument. Second argument must be one of the following: "%s". Value: `%s`.', NORMS.join( '", "' ), norm ) );
6566
}
6667
return base( norm, M, N, A, strideA1, strideA2, offsetA, work, strideWork, offsetWork ); // eslint-disable-line max-len
6768
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"norms": [
3+
"max",
4+
"one",
5+
"infinity",
6+
"frobenius"
7+
]
8+
}

0 commit comments

Comments
 (0)